Question

I'm at a complete loss with getting the shared caching to work.

Locally, I've got an mvc4 site running and I created a cloud project from this. I enabled caching on the role and set this to be co-located. All fine so far.

I added the Windows Azure Caching 2.1 package from NuGet which installed the relevant libraries and also updated my web config:

configSections:

<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
<section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" />

config:

<dataCacheClients>
<dataCacheClient name="default">
  <!--To use the in-role flavor of Windows Azure Caching, set identifier to be the cache cluster role name -->
  <!--To use the Windows Azure Caching Service, set identifier to be the endpoint of the cache cluster -->
  <autoDiscover isEnabled="true" identifier="" />
  <!--<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
  <!--Use this section to specify security settings for connecting to your cache. This section is not required if your cache is hosted on a role that is a part of your cloud service. -->
  <!--<securityProperties mode="Message" sslEnabled="false">
    <messageSecurity authorizationInfo="[Authentication Key]" />
  </securityProperties>-->
</dataCacheClient>

When I follow the instructions and add the role name to identifer attribute on the autoDiscover element and run the app, it seems to just hang (I'm assuming failing) on this:

_cache = new DataCache("default");

I have the storage emulator running and the site debugging from the compute emulator. I just can't seem to get the site to work configured to use the azure cache.

Was it helpful?

Solution

Please make sure that you're using SDK version 2.1. Caching 2.1 package will only work with the latest version of SDK (see the screenshot below). You may want to check out this thread here: Exception while using Windows Azure Caching : No such host is known

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top