Exception while using Windows Azure Caching : No s

2020-02-06 02:07发布

问题:

I am trying to get started with Azure and am trying to use the Caching feature. I created a cloud service project and added a Cache worker role and a web role. I installed "Windows Azure Caching" nuget into projects for both the roles and added the name of cache worker role as identifier in DataCacheClients element in web.config of the web role.

I added the following code into the web role:

DataCacheFactory cf = new DataCacheFactory();
DataCache c = cf.GetDefaultCache();

When I try to run this locally on the emulator, I get the following exception:

    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.). 
Additional Information : The client was trying to communicate  with the server: net.tcp://MvcWebRole1:24233.


Inner Exception : No such host is known

Can you please tell me what I am missing here?

Azure SDK used : v2.0

回答1:

Timing of your question couldn't be better. We also faced exactly the same issue and were scrathing our head as to what the problem could be. We had one project where everything worked perfectly fine and in one we were getting the same error. Based on our research, we have identified the problem with the Nuget package for caching. It seems a new version (2.1.0.0) was released yesterday and we found that if we install that package, we get this error. Can you check the package version in your case? The documentation states that this new version can only be used with the latest SDK (2.1) released today.

One solution would be to uninstall version 2.1.0.0 and install version 2.0.0.0. To install version 2.0.0.0, open Package Manager Console (View --> Other Windows --> Package Manager Console) and type following command there:

Install-Package Microsoft.WindowsAzure.Caching -Version 2.0.0.0

This fixed our problem. Hopefully it should fix yours too.



回答2:

Here is a link to the Windows Azure Cloud Integration Engineering blog on how to deal with this same issue. They recommend upgrading to Azure SDK v 2.1 or rolling back as the accepted answer states.

http://blogs.msdn.com/b/cie/archive/2013/08/08/windows-azure-caching-2-1-0-0-no-such-host-is-known.aspx



回答3:

This exception could also occur under compute emulator if for the role in the client library configuration there is no cache configured. In my case this happened on purpose, since the cache emulator has some problems that can slow down the test and debugging on the service.

In previous version of Windows Azure Caching, in this scenario the construction of DataCacheFactory would fail with an exception (handled by my code); with Windows Azure Caching 2.1 (and Azure SDK 2.1) in this same scenario the code would consider the role name as a server address and thus on DataCache construction would try to communicate with the non existing cache -- this leads to a 3 minute wait and the exception reported in the question.

I have changed my code to detect the new situation for this scenario -- you can find more detail in this SO question.



标签: caching azure