1

I have been battling to get in-role, co-located caching (not dedicated) working in Azure.

In my MVC WebApi 2 project's web.config:

<configSections>
  <section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
...
<dataCacheClients>
  <dataCacheClient name="default" isCompressionEnabled="true">
    <autoDiscover isEnabled="true" identifier="MyWebApiProject" />
    <clientNotification pollInterval="300" />
    <transportProperties maxBufferSize="1073741824" maxBufferPoolSize="1073741824"/>
  </dataCacheClient>
</dataCacheClients>

Cache property setting on the role:

Role Properties

I got the following exception thrown in Azure:

Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.). Additional Information : The client was trying to communicate with the server: net.tcp://MyWebApiProject:24233.

When I turn autoDiscover off, like this:

<autoDiscover isEnabled="false" identifier="MyWebApiProject" />

Then I get a different exception:

Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:Server collection cannot be empty.

I don't have any problems when running locally using the Compute Emulator.

Dave New
  • 38,496
  • 59
  • 215
  • 394

1 Answers1

2

Once I upgraded my Azure SDK from 2.2 to 2.3, this problem stopped occurring.

Dave New
  • 38,496
  • 59
  • 215
  • 394
  • 2
    Just to add to this. The Azure SDK Tools and Azure DLL's from your NuGet packages must be the same version. These problems normally occur when you update one but not the other. Strange things always start to happen. If you upgrade the Tools you will need to go to your Azure project, right click and press properties, then press Upgrade. – Adam Aug 07 '14 at 08:29
  • @Adam: Yes, I have found similar behaviour. Thanks for the comment. – Dave New Aug 07 '14 at 08:36