销售电话: 1-800-867-1380

 none
AzureCacheSessionStoreProvider doesn work with emulator

    问题

  • Hi!

    I have setup with solutions running on my machine with 2 instances and AzureCacheSessionStoreProvider that uses cloud.

    Web.config contains following:

    <sessionState mode="Custom" customProvider="AzureCacheSessionStoreProvider">
          <providers>
            <add name="AzureCacheSessionStoreProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" useBlobMode="true" dataCacheClientName="default" sharedId="mySharedId" />
          </providers>
        </sessionState>

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

    <dataCacheClients>
        <dataCacheClient name="default">
          <hosts>
            <host name="myName.cache.windows.net" cachePort="22233" />
          </hosts>
          <securityProperties mode="Message">
            <messageSecurity authorizationInfo="myKey" />
          </securityProperties>
        </dataCacheClient>
      </dataCacheClients>

    Simple check shows that sessions are different on two instances:

    if (string.IsNullOrEmpty(Session["asdf"as string))
            Session["asdf"] = Settings.InstanceName;
    Assert.IsTrue((Session["asdf"as string) == Settings.InstanceName, "Different");

    Code does not crash! But it works as expect when deployed to Azure.

    Here in the comments I found two guys reporting the same problem.

    Anyone knows how this can be cured?

    2012年5月15日 16:08

答案

  • Hi,

    Your configuration looks OK, Did you put the <configSections> at the top of the <configuration> section? And for this similar thread, it seems that some there's a existing issues in Azure emulator, the Caching service not works fine in Azure emulator with 2 or more instances, but if deploy the application on Cloud, it should works.

    BR,

    Arwind


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    2012年5月16日 5:58

全部回复

  • Hi,

    Your configuration looks OK, Did you put the <configSections> at the top of the <configuration> section? And for this similar thread, it seems that some there's a existing issues in Azure emulator, the Caching service not works fine in Azure emulator with 2 or more instances, but if deploy the application on Cloud, it should works.

    BR,

    Arwind


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    2012年5月16日 5:58
  • Hi,

    Your configuration looks OK, Did you put the <configSections> at the top of the <configuration> section? And for this similar thread, it seems that some there's a existing issues in Azure emulator, the Caching service not works fine in Azure emulator with 2 or more instances, but if deploy the application on Cloud, it should works.

    BR,

    Arwind


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    Yes, everything works fine in Azure. But it turns development in real pain when you need to wait 30min to see if your code works or not.

    Thank you for the link, I'll try Server AppFabric provider.

    2012年5月16日 6:58
  • Yes, if you still has any further issue about this problem, please inform me, Thanks.

    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    2012年5月16日 7:57