c# - 如何解决Azure中NHibernate缓存的 "This operation is not supported by the cache."问题?

标签 c# nhibernate azure distributed-caching azure-appfabric

我正在尝试使用 NHibernate.Caches.Velocity 实现 Nhibernate 二级缓存并讨论 here on stack overflow使用这个this blog post .

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

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

"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>

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

最佳答案

我不能肯定地说,因为我不熟悉 NHibernate 尝试使用缓存的方式,但 Azure 缓存不支持本地缓存的所有功能。我猜想它正在尝试利用不受支持的功能。 MS有一个list of the differences between the two

关于c# - 如何解决Azure中NHibernate缓存的 "This operation is not supported by the cache."问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9830844/

相关文章:

c# - 使用 Task.Factory.StartNew().ContinueWith() 的单元测试代码

c# - 将 SQL 查询转换为 NHibernate 条件查询

Azure QnA 服务部署在门户中失败 - 模板无效

azure - 嵌套复制循环ARM模板

c# - 扩展基类以包含详细信息?

c# - 从 Viewbag.List 中查找项目

c# - (N)Hibernate 在查询中选择常量

entity-framework - DevExpress XPO 与 NHibernate 与 Entity Framework : database upgrading issue

azure - 如何在 Azure Functions Premium 中配置预热实例?

c# - 如何使用 MVVM light 处理 WP 8.1 上的后退按钮?