2012-03-22 70 views
1

我想使用NHibernate.Caches.Velocity實現Nhibernate二級緩存,並使用此this blog post討論here on stack overflow如何解決「緩存不支持此操作」。在Azure中使用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> 

有沒有人有線索是什麼原因造成的?我得到零相關的結果,如果我谷歌。

回答

0

我不能肯定地說,因爲我不熟悉NHibernate試圖使用緩存的方式,但Azure緩存不支持內部緩存的所有功能。我猜測它試圖利用不支持的功能。 MS有一個list of the differences between the two

+0

謝謝。似乎是這樣,因爲沒有其他明顯的原因。 – 2012-03-23 07:41:37