I'm trying to set up caching between my worker role instances. To do this, I added a new cache worker role to my Azure project. However, when I try to access the default cache with the following code:
_dataCacheFactory = new DataCacheFactory();
var cache = _dataCacheFactory.GetDefaultCache();
I never get the default cache back, and the call times out. I copied my app.config file from the Azure documentation, and added my role name in the identifier tag:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<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" />
</configSections>
<dataCacheClients>
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="Cache" />
<!--<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />-->
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Off" dumpStorageQuotaInMB="100" />
</cacheDiagnostics>
</configuration>
I've double checked that the name of my Cache worker role is indeed "Cache". On both my Cache worker role and my normal worker role, I've set the following things in the "Caching" tab of the configuration tab:
- Enable Caching
- Cache Cluster Settings set to "Dedicated Role"
- Storage Account Credentials: UseDevelopmentStorage=true
I'm currently running this on the Azure Compute Emulator. I can see that both my worker role and my cache worker role are up and running. Is there some configuration setting that I'm missing or have set incorrectly? Thanks!