0
votes

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!

1
Please take a look at this thread and see if that's not causing the problem you're facing: stackoverflow.com/questions/18045279/….Gaurav Mantri
Cache feature works only on Azure, but no on Emulator. Did you try to run it on Azure, what's the error you've got?Vladimir Dorokhov
@VladimirDorokhov - I'm not sure if this statement is correct. Caching feature works on both Emulator and in the cloud.Gaurav Mantri
Thanks Guarav! Updating my SDK version to 2.1 seems to have solved the problem. I am able to access my cache worker role now, even on the Azure Compute Emulator. Word of caution: NuGet didn't tell me that there was a new version of the Azure SDK, so even if it appears your SDK is up to date, it may not be.mobius

1 Answers

0
votes

Hello maybe you should try to set the connection between them using Inter Role Communication, you can find an answer for how to make the inter role communication in the following stackoverflow website: How to do inter-role communication with Azure?

you can also find more details in the following link: http://blogs.msdn.com/b/avkashchauhan/archive/2011/10/30/communication-between-windows-azure-roles.aspx

I hope this helps you solve your problem please let me know if you need anything else.