相关疑难解决方法(0)

AppFabric:无法联系缓存服务

更新:我现在已经正确实现了这一点.有关更多信息,请参阅我的博客文章.

我正在尝试使用AppFabric和NHibernate作为我的二级缓存提供程序,但是我收到以下错误:ErrorCode:Initialization:无法联系缓存服务.有可能的原因,请联系管理员并参阅产品帮助文档.

我认为问题出在我在web.config中的配置:

    <section name="dcacheClient" 
             type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core"
             allowLocation="true" 
             allowDefinition="Everywhere"/>
...
  <dcacheClient deployment="routing" localCache="False">
    <localCache isEnabled="false" sync="TimeoutBased" ttlValue="300" />
    <hosts>
      <host name="localhost" cachePort="22233" cacheHostName="AppFabricCachingService" />
    </hosts>
  </dcacheClient>
Run Code Online (Sandbox Code Playgroud)

我已经下载了NHibernate.Caches源代码,试图找出问题所在,并在调用GetCache方法时在VelocityClient构造函数中抛出异常:

  public VelocityClient(string regionName, IDictionary<string, string> properties)
  {
      region = regionName.GetHashCode().ToString(); //because the region name length is limited
      var cacheCluster = new CacheFactory();
      cache = cacheCluster.GetCache(CacheName);
      try
      {
          cache.CreateRegion(region, true);
      }
      catch (CacheException) {}
  }
Run Code Online (Sandbox Code Playgroud)

如果我将一个监视添加到cacheCluster变量,我可以找到一个_servers私有变量,它有一个System.Data.Caching.EndpointID,其MyURI属性设置为net.tcp:// localhost:22234/AppFabricCachingServive,我认为它已经来了来自web.config中的配置.

如果您不知道问题的确切原因,但对如何解决此问题有一些想法,那也将非常感激.

附加信息


我从命令中得到以下结果Get-CacheHostConfig -HostName tn-staylor-02 -CachePort 22233:

HostName        : tn-staylor-02
ClusterPort …
Run Code Online (Sandbox Code Playgroud)

nhibernate appfabric

18
推荐指数
1
解决办法
5483
查看次数

标签 统计

appfabric ×1

nhibernate ×1