【问题标题】:Windows Server AppFabricCache, Exception, Check the client versionWindows Server AppFabricCache,异常,检查客户端版本
【发布时间】:2014-07-18 12:23:30
【问题描述】:

我正在尝试构建和运行WindowsServerAppFabricSamples CacheAPISample 应用程序。我必须从 nuget 安装 Microsoft.WindowsAzure.Caching 版本 2.3.1.0 才能构建。我的配置是:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere"/>
    <section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere"/>
  </configSections>
  <dataCacheClients>
    <dataCacheClient name="default" />
  </dataCacheClients>          
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

当我运行应用程序时,我收到异常消息:

检查客户端版本。它应该在允许的版本内 服务器上的范围。如有必要,将客户端升级到允许的 版本。

异常跟踪:

Microsoft.ApplicationServer.Caching.DataCacheException was unhandled
  HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049
  HResult=-2146233088
  Message=ErrorCode<ERRCA0019>:SubStatus<ES0001>:Check the client version. It should be within the allowed version range on the server. If necessary, upgrade the client to the allowed version.
  Source=Microsoft.ApplicationServer.Caching.Client
  ErrorCode=19
  SubStatus=-1
  StackTrace:
       at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination)
       at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, EndpointID destination)
       at Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable`1 servers, RequestBody request, Func`3 sendMessageDelegate, DataCacheReadyRetryPolicy retryPolicy)
       at Microsoft.ApplicationServer.Caching.WcfClientProtocol.Initialize(IEnumerable`1 servers)
       at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName, CreateNewCacheDelegate cacheCreationDelegate, DataCacheInitializationViaCopyDelegate initializeDelegate)
       at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName)
       at CacheAPISample.Program.PrepareClient() in c:\Programming\WindowsServerAppFabricSamples\Samples\CS\Cache\CacheAPISample\CacheAPISample\Program.cs:line 617
       at CacheAPISample.Program.Main(String[] args) in c:\Programming\WindowsServerAppFabricSamples\Samples\CS\Cache\CacheAPISample\CacheAPISample\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

负责的代码部分是:

private void PrepareClient()
{
    List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(1);
    servers.Add(new DataCacheServerEndpoint("localhost", 22233));
    DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();
    configuration.Servers = servers;
    configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();
    DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);
    myCacheFactory = new DataCacheFactory(configuration);
    // Breaks after this comment.
    myDefaultCache = myCacheFactory.GetCache("default");
}

在管理 Windows PowerShell 中,我运行了 get-cachehost 命令。这是我得到的:

HostName : CachePort Service Name            Service Status Version Info
-------------------- ------------            -------------- ------------
KOKICA:22233         AppFabricCachingService UP             3 [3,3][1,3]

服务器和客户端应用程序都在同一台 Windows 8.1 机器上运行。 AppFabric 1.1 已安装。缓存依赖项

Microsoft.ApplicationServer.Caching.Client.dll, Microsoft.ApplicationServer.Caching.Core

C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\v2.2\ref\Caching

文件版本为 1.0.5137.0。任何帮助我解决此问题的尝试将不胜感激。

【问题讨论】:

    标签: c# powershell caching appfabric appfabric-cache


    【解决方案1】:

    您提到的库用于 Azure 缓存,而您正在寻找的是用于 Windows 服务器的 onPremise Appfabric 的客户端库。

    如果你从这里安装了 Microsoft Appfabric 1.1 for windows server:http://www.microsoft.com/en-us/download/details.aspx?id=27115, 您需要右键单击您的客户端项目属性并从 c:\Program Files\Windows Server Appfabric 或您安装的任何文件夹中引用客户端 dll(Microsoft.ApplicationServer.Caching.Client.dll 和 Microsoft.ApplicationServer.Caching.Core.dll.)它到。 (安装时,您应该选中复选框“安装客户端”

    更多详情请参考此链接: http://msdn.microsoft.com/en-us/library/hh334398(v=azure.10).aspx

    【讨论】:

    • 谢谢。无法确认答案是否正确。已更改参考。在客户端上设置了new DataCacheSecurity(DataCacheSecurityMode.None, DataCacheProtectionLevel.None);。在服务器上调整了set-cacheclustersecurity None None。专用网络的 Windows 防火墙已关闭。我遇到了异常:ErrorCode&lt;ERRCA0019&gt;:SubStatus&lt;ES0001&gt;:Check the client version. It should be within the allowed version range on the server. If necessary, upgrade the client to the allowed version.
    • 你能检查一下是否没有旧引用是 GAC 的吗?(转到 \Windows\assembly 并删除所有以 Microsoft.ApplicationServer.caching 开头的引用。)。使用新的引用重建项目并重试。如果这不起作用,您可以从 powershell 粘贴 Get-CacheHost 的结果吗?要查看完整结果,您可能需要增加 powershell 窗口的宽度。
    • Get-CacheHost 的结果:HostName:KOKICA PortNo:22233 ServiceName:AppFabricCachingService 状态:Up VersionInfo:3[3,3][1,3]
    • 我已经检查了加载的程序集。我在抛出异常的行之前放置了断点,并在快速监视窗口中输入了 AppDomain.CurrentDomain.GetAssemblies()。 {Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35} {Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35} 看起来没问题?
    【解决方案2】:

    Microsoft Windows Server AppFabric Cookbook,Installing Cache Client Assemblies 章节,工作原理...再次提醒我,就像 @Alfan 累了一样,第 n 次检查服务器服务可执行文件版本和客户端程序集文件版本磁盘。

    令人困惑的是我已经从MS download center page (...\Program Files\AppFabric 1.1 for Windows Server) 安装了 AppFabric Cache,但已经安装了 Windows Azure SDK v2.2 (...\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.2\ref\Caching )。两种安装都有 Microsoft.ApplicationServer.Caching.Client.dll、Microsoft.ApplicationServer.Caching.Core.dll 文件。

    我引用了 SDK 的文件 (v 1.0.5137.0),但版本不匹配。我从 AppFabric Cache (v 1.0.4632.0) 文件夹中引用了程序集,它解决了我的问题。

    旁注 两个文件版本在运行AppDomain.CurrentDomain.GetAssemblies() 时报告相同的版本号 来自客户端应用程序。

    【讨论】:

      猜你喜欢
      • 2012-01-02
      • 2012-05-19
      • 2016-10-10
      • 1970-01-01
      • 1970-01-01
      • 2022-07-02
      • 2017-01-07
      • 2011-04-18
      • 1970-01-01
      相关资源
      最近更新 更多