title: How to solve "This operation is not supported by the cache." for NHibernate cache in Azure?
body: <p>I'm trying to implement Nhibernate 2nd level cache using the NHibernate.Caches.Velocity and discussed <a href="https://stackoverflow.com/questions/3233792/appfabric-could-not-contact-the-cache-service">here on stack overflow</a> using this <a href="http://www.sharpcoder.co.uk/post/2012/01/11/NHibernateCachesAppFabric-Documentation.aspx" rel="nofollow noreferrer">this blog post</a>.</p>
  
  <p>The application is Azure WebRole using Nhibernate 3.2.</p>
  
  <p>Everything seems to be correct except for an exception that is being thrown when initializing the Session Factory:</p>
  
  <pre><code>"This operation is not supported by the cache."
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Web.Config:</p>
  
  <pre><code>  &lt;dataCacheClients&gt;
      &lt;dataCacheClient name="default"&gt;
        &lt;hosts&gt;
          &lt;host name="xxx.cache.windows.net" cachePort="22233" /&gt;
        &lt;/hosts&gt;
        &lt;securityProperties mode="Message"&gt;
          &lt;messageSecurity
            authorizationInfo="xxx"&gt;
          &lt;/messageSecurity&gt;
        &lt;/securityProperties&gt;
      &lt;/dataCacheClient&gt;
    &lt;/dataCacheClients&gt;
  </code></pre>
  
  <p>Does anyone have a clue what is causing this? I get zero relevant results if i google it.</p>