如何解决“;缓存不支持此操作";用于Azure中的NHibernate缓存

本文关键字:缓存 quot 操作 用于 Azure NHibernate 中的 不支持 解决 何解决 | 更新日期: 2023-09-27 18:28:38

我正在尝试使用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

Web.Config:

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

有人知道是什么原因造成的吗?如果我在谷歌上搜索,我得到的结果为零。

如何解决“;缓存不支持此操作";用于Azure中的NHibernate缓存

我不能肯定,因为我不熟悉NHibernate尝试使用缓存的方式,但Azure缓存并不支持内部缓存的所有功能。我猜它是在试图利用不受支持的函数。MS有两个之间的差异列表