0

I was reading in the following page that continualy WindowsAzure recycle store sessions

Why do my instances recycle when trying to store sessions in co-located Azure cache?

This is my webconfig setting:

<sessionState mode="InProc" timeout="2880" />

I was reading that maybe I have to change the Mode to maintain the session alive, because when I'm using the program, suddenly happens that. Let's going to see later than one hour.

What can I do to avoid this bad user experience?

Community
  • 1
  • 1
Darf Zon
  • 6,268
  • 20
  • 90
  • 149

1 Answers1

1

If you are running multiple instances, then you are losing session data as the load balancer bounces users between instances. The "InProc" setting stores the session data on each individual instance and NOT across instances - read more.

If you want to use co-located cache then your config should look something like:

<!-- Windows Azure Caching session state provider -->
<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
  <providers>
    <add name="AFCacheSessionStateProvider" 
      type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache"
      cacheName="shared" 
      dataCacheClientName="shared" 
      applicationName="AFCacheSessionState"/>
  </providers>
</sessionState>

Read more.

UPDATE: Finally, check that you are using a REAL BLOB connection string in your ServiceConfiguration.cscfg file. If the connection string says "UseDevelopmentStorage=true", the deployed role will never be able to create/connect to the cache - it will work locally in the emulator though.:

<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="UseDevelopmentStorage=true" />
viperguynaz
  • 12,044
  • 4
  • 30
  • 41
  • Sorry for the late, but I spend all these days to implemented it. I create a new azure project where includes my MVC Applicacion and also I added a Cache role (as dedicated role). Is there any problem if I'm not using co-located? I reay don't know the difference between them – Darf Zon Apr 14 '13 at 18:37
  • Wait a minute! In fact I'm not running multiple instances, my page is using a Shared Mode with just only instance – Darf Zon Apr 14 '13 at 20:53
  • See update added above - recycling ache when deployed is a symptom of having the Cache BLOB configurations string set to "UseDevelopmentStorage=true" – viperguynaz Apr 15 '13 at 16:15