我正在尝试使用NHibernate.Caches.Velocity实现Nhibernate二级缓存,并使用此here on stack overflow讨论了this blog post。
该应用程序是使用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>
有没有人知道造成这种情况的原因是什么?如果我谷歌它,我得到零相关结果。
答案 0 :(得分:0)
我不能肯定地说,因为我不熟悉NHibernate尝试使用缓存的方式,但Azure缓存不支持内部部署缓存的所有功能。我猜它正试图利用不支持的功能。 MS有一个list of the differences between the two