使用Windows Azure缓存时出现异常:未知此类主机

时间:2022-10-05 20:49:16

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.

我正在尝试使用Azure,并尝试使用缓存功能。我创建了一个云服务项目,并添加了一个缓存工作者角色和一个Web角色。我将“Windows Azure Caching”nuget安装到两个角色的项目中,并在Web角色的web.config中的DataCacheClients元素中添加了缓存工作者角色的名称作为标识符。

I added the following code into the web role:

我将以下代码添加到Web角色中:

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

使用的Azure SDK:v2.0

3 个解决方案

#1


14  

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.

你的问题的时机不可能更好。我们也面临着完全相同的问题,并且对于问题可能是我们的头脑。我们有一个项目,一切都工作得很好,在一个项目中,我们得到了同样的错误。根据我们的研究,我们已经确定了Nuget包的缓存问题。似乎昨天发布了新版本(2.1.0.0),我们发现如果我们安装该软件包,就会收到此错误。你可以检查你的包装版本吗?该文档指出,此新版本只能与今天发布的最新SDK(2.1)一起使用。

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:

一种解决方案是卸载2.1.0.0版并安装2.0.0.0版。要安装版本2.0.0.0,请打开程序包管理器控制台(查看 - >其他Windows - >程序包管理器控制台),然后在其中键入以下命令:

Install-Package Microsoft.WindowsAzure.Caching -Version 2.0.0.0

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

这解决了我们的问题。希望它也能解决你的问题。

#2


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.

以下是有关如何处理此问题的Windows Azure云集成工程博客的链接。他们建议升级到Azure SDK v 2.1或按接受的答案状态回滚。

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

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

#3


1  

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.

在以前版本的Windows Azure缓存中,在这种情况下,DataCacheFactory的构造将失败并出现异常(由我的代码处理);在同一场景中使用Windows Azure Caching 2.1(和Azure SDK 2.1),代码会将角色名称视为服务器地址,因此DataCache构建将尝试与非现有缓存进行通信 - 这会导致等待3分钟问题中报告的例外情况。

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

我已经更改了我的代码以检测此场景的新情况 - 您可以在此SO问题中找到更多详细信息。

#1


14  

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.

你的问题的时机不可能更好。我们也面临着完全相同的问题,并且对于问题可能是我们的头脑。我们有一个项目,一切都工作得很好,在一个项目中,我们得到了同样的错误。根据我们的研究,我们已经确定了Nuget包的缓存问题。似乎昨天发布了新版本(2.1.0.0),我们发现如果我们安装该软件包,就会收到此错误。你可以检查你的包装版本吗?该文档指出,此新版本只能与今天发布的最新SDK(2.1)一起使用。

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:

一种解决方案是卸载2.1.0.0版并安装2.0.0.0版。要安装版本2.0.0.0,请打开程序包管理器控制台(查看 - >其他Windows - >程序包管理器控制台),然后在其中键入以下命令:

Install-Package Microsoft.WindowsAzure.Caching -Version 2.0.0.0

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

这解决了我们的问题。希望它也能解决你的问题。

#2


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.

以下是有关如何处理此问题的Windows Azure云集成工程博客的链接。他们建议升级到Azure SDK v 2.1或按接受的答案状态回滚。

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

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

#3


1  

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.

在以前版本的Windows Azure缓存中,在这种情况下,DataCacheFactory的构造将失败并出现异常(由我的代码处理);在同一场景中使用Windows Azure Caching 2.1(和Azure SDK 2.1),代码会将角色名称视为服务器地址,因此DataCache构建将尝试与非现有缓存进行通信 - 这会导致等待3分钟问题中报告的例外情况。

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

我已经更改了我的代码以检测此场景的新情况 - 您可以在此SO问题中找到更多详细信息。