1

我正在尝试使用 NHibernate.Caches.Velocity 实现 Nhibernate 二级缓存,并使用此博客文章在此处讨论堆栈溢出

该应用程序是使用 Nhibernate 3.2 的 Azure WebRole。

除了初始化会话工厂时抛出的异常之外,一切似乎都是正确的:

"This operation is not supported by the cache."

堆栈跟踪:

at Microsoft.ApplicationServer.Caching.DataCacheFactory.ThrowNotSupportedException()
   at Microsoft.ApplicationServer.Caching.DataCacheFactory.CreateHybridClient(String cacheName, NamedCacheConfiguration config, SimpleSendReceiveModule sendRcvModule)
   at Microsoft.ApplicationServer.Caching.DataCacheFactory.CreateNewCacheClient(DataCacheDeploymentMode mode, String cacheName, NamedCacheConfiguration config, SimpleSendReceiveModule sendRcvModule)
   at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName)
   at NHibernate.Caches.AppFabric.AppFabricCacheFactory.GetCache(String cacheName, Boolean useDefault)
   at NHibernate.Caches.AppFabric.AppFabricCacheAdapter..ctor(String regionName)
   at NHibernate.Caches.AppFabric.Adapters.AppFabricCacheNamedAdapter..ctor(String regionName)
   at NHibernate.Caches.AppFabric.AppFabricCacheAdapterFactory.Create(String regionName)
   at NHibernate.Caches.AppFabric.AppFabricProvider.BuildCache(String regionName, IDictionary`2 properties)
   at NHibernate.Cache.UpdateTimestampsCache..ctor(Settings settings, IDictionary`2 props)
   at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 230

网络配置:

  <dataCacheClients>
    <dataCacheClient name="default">
      <hosts>
        <host name="xxx.cache.windows.net" cachePort="22233" />
      </hosts>
      <securityProperties mode="Message">
        <messageSecurity
          authorizationInfo="xxx">
        </messageSecurity>
      </securityProperties>
    </dataCacheClient>
  </dataCacheClients>

有谁知道是什么原因造成的?如果我用谷歌搜索,我得到的相关结果为零。

4

1 回答 1

0

我不能肯定地说,因为我不熟悉 NHibernate 尝试使用缓存的方式,但是 Azure 缓存不支持本地缓存的所有功能。我猜它试图利用不受支持的功能。MS列出了两者之间的差异

于 2012-03-23T04:12:50.700 回答