Co-located cache problem


  • Hi,

    I'm trying to get distributed Session working with co-located caching on my webroles.

    After configuring the cache on the webrole properties, I add the web.config entries below.

    Unfortunately when I launch the emulator I get a startup error: "There was an error attaching the debugger to the IIS worker process..."

    If I comment out the last <sessionState mode="Custom" 

    section, then the app runs, but of course the session goes out of sync with multiple instances.

    If I run without debugging I get a server error 500.

    Any help would be greatly appreciated.


        <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" />

        <dataCacheClient name="default">
            <host name="" cachePort="22233" />
          <securityProperties mode="Message">

        <dataCacheClient name="SslEndpoint">
            <host name="" cachePort="22243" />
          <securityProperties mode="Message" sslEnabled="true">

        <sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
            <add name="AppFabricCacheSessionStoreProvider"
                  type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"

    Tuesday, December 04, 2012 5:35 PM

All replies

  • Hi,

    Make sure you are using the latest SDK (1.8) and that you are referencing the correct DLL's as well. And try this:

        <sessionState mode="Custom" customProvider="defaultProvider" timeout="60">
            <add cacheName="default" name="defaultProvider" dataCacheClientName="sessionState" applicationName="YOURAPPNAME" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" />

    Make sure you create a specific named cache on your WebRole configuration, just for sessionState:

    I Also recommend you reading this MSDN topic: Windows Azure Caching on Existing Roles

    Hope this helps!

    Best Regards,
    Carlos Sardo

    Tuesday, December 04, 2012 10:56 PM
  • I made sure that I had SDK 1.8, and included everything else.

    Now my app simply stalls on startup and I get the warning that the Role Instance is taking longer than usual to start, do I want to continue waiting?

    Without meaningful error messages, how can I find out what I'm missing here?

    Wednesday, December 05, 2012 1:27 AM
  • BTW is [ApplicationName] actually supposed to be the name of the role containing the cache?
    Wednesday, December 05, 2012 1:30 AM
  • Hi..

    When you uncomment the session state section to use Windows Azure Cache, can you make sure you have commented out the default session state provider ? Usually , it is:

    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />

     Two session state Providers cannot run at once. This could be the issue.

    About ApplicationName tag, it is the one used by each instance of your role as the sole identifier of one another. More details are available in this link:


    Alfan T P

    Thursday, December 06, 2012 7:41 AM
  • It looks like I actually have this problem:

    I get the same errors showing up in the event viewer.

    However I am at a loss as of how to "clean up" my GAC or find which assemblies need removing.

    Sunday, December 09, 2012 3:36 AM
  • Have you installed Windows Server AppFabric assembly as elastacloud said in that post? Try to uninstall it and check it again. 

    How to Uninstall an Assembly from the GAC 

    • Proposed as answer by _mmjj_jjyy Wednesday, December 19, 2012 9:45 AM
    Tuesday, December 11, 2012 12:16 PM
  • I thought I had uninstalled it.
    I can't see any AppFabric assemblies in GAC, but maybe I'm missing them.

    I don't know explicitly what they are named.

    Tuesday, December 11, 2012 3:07 PM
  • I think you can ask for help from elastacloud by following up that post. Haven't tried Caching Preview and never encounter this issue, maybe someone else who have the same issue will point you out. 
    Wednesday, December 12, 2012 1:55 AM