Azure 缓存无效标识符

Azure cache Invalid identifier

因此,当我在我的工作者角色中尝试缓存时,我在本地遇到了这个错误:

ErrorCode<ERRCA0042>:SubStatus<ES0001>:Invalid identifier: 'Fildela Worker'. Check cache rolename/endpoint in configuration.

上线:

<autoDiscover isEnabled="true" identifier="Fildela Worker" />

在我的 MVC 应用程序中,webconfig。

所以我将我的 Azure SDK 版本更新为 2.5.1,并将我的 Visual Studio 2013 版本更新为 Update 4瞧!成功了!

然而,当我将项目作为云应用程序发布到 Azure 时,错误消息再次出现。我的缓存在本地主机上有效,但在发布到 Azure 时无效。

这是为什么?

谢谢!

编辑 1

我正在使用最新的 Windows Azure 缓存 2.5.10。

当标识符被验证为托管缓存的 URI 时会抛出此特定错误。 Azure 缓存客户端首先尝试将给定的标识符用作角色,如果失败则用作端点。所以我认为您的客户端可能无法连接到您的缓存服务器角色。原因之一可能是 Azure SDK 和缓存客户端的版本不兼容,但由于您使用的可能不是这种情况。您可以尝试的几件事是清理客户端库并将它们添加回去以验证客户端位是否已更新。您还可以 check/share 客户端跟踪找出缓存服务器角色连接失败的原因。

我将我的 Windows Azure 缓存从 2.5.10 降级到 2.0.0,它成功了!缓存在本地和发布时都有效。

但是我在这样做的时候遇到了一些问题。

当我安装 2.0.0 时,包管理器控制台出现异常:

Exception calling "Item" with "1" argument(s): "InvalidParameter
Parameter name: index"

当我随后开始我的网络角色时,我遇到了另一个异常:

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.":"Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

然后我检查了我的 ServiceRuntime 版本,它是 2.3.0.0,而不是 2.0.0.0。

所以我打开我的 webconfig 并添加了这段代码:

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
  </dependentAssembly>

多田!大功告成!