Trying to create a new Dedicated Cache Role in Windows Azure but get the NotSupportedException: This operation is not supported by the cache exception every time I run this code. As a summary, here is what I’ve done…
I construct the cache using the following code, and the exception occures as soon as I call GetCache(string):
_dataCacheFactory = new DataCacheFactory();
_cache = _dataCacheFactory.GetCache(cacheName);
Additionally, I’ve added the appropriate <dataCacheClients> configuration section and references to the following assemblies (All reference the assemblies in Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref):
- Microsoft.ApplicationServer.Caching.AzureClientHelper
- Microsoft.ApplicationServer.Caching.AzureCommon
- Microsoft.ApplicationServer.Caching.Client
- Microsoft.ApplicationServer.Caching.Core
- Microsoft.Web.DistributedCache
I have also setup the Cache Worker Role in the Azure project.
As far as I can tell I’ve followed all the MSDN documentation, can anyone suggest what may be wrong here?
I’m guessing you’re trying to get a named cache, which is not supported in Azure Shared Caching. Instead of
_dataCacheFactory.GetCache(cacheName), try using_dataCacheFactory.GetDefaultCache().