Applications using Azure cache might commonly encounter exceptions similar to below while performing cache operations like get, put. We refer to these kind of errors as transient errors. Developer is required to implement retry logic in the application code to shield the application from transient errors.
ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)
Thanks to “Transient fault handling application block” from patterns & practices team. It is now very easy to implement sophisticated retry logic in your application. I’m describing the instructions in 3 steps here.
- Add the Transient Fault Handling Application Block to your application
- Install latest version of NuGet from here http://nuget.org/.
- Add a reference to the Transient Fault Handling Application Block assemblies. In Microsoft Visual Studio, right-click your project node in Solution Explorer, and then click Manage NuGet Packages.
- Click the Online button, and then in the Search Online box, type topaz.
- Click the Install button for the Enterprise Library 5.0 – Transient Fault Handling Application Block package.
- Read and accept the license terms for the packages listed.
- After NuGet has finished installing the packages, click Close.
- NuGet has now updated your project with all the necessary assemblies and references that you need to use the Transient Fault Handling Application Block. The project now also includes a readme file that contains important information about the Transient Fault Handling Application Block.
- Configure retry policy for your application.
Make azure cache calls inside ExecuteAction delegate as shown below.
Download the sample source code here
Windows Server AppFabric Caching – Table of Error Code Strings
Exception Handling Overview (Windows Server AppFabric Caching) – Also applicable to Azure AppFabric Caching
Application Exceptions (Windows Server AppFabric Caching)
Transient Fault Handling
Post your comments, feedback using comments section below!