Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Azure table storage for ASP.NET session

In Azure, sessions are not sticky so it's not sufficient to use InProc session when you have multiple Web role instances (which you should, otherwise you're not covered by the Windows Azure Compute SLA which guarantees 99.95% uptime.).

Therefore I would like to use Azure table storage for ASP.NET session. I am familiar with SQL Azure, but have not yet used Azure table storage.

I am told that the appropriate way to do this is using the ASP.NET Universal Providers, along with a small amount of web.config trickery.

So far, I have not been able to get this working. There are a variety of postings around this topic, but a lot of them point to using Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider, which looks like a precursor to the Universal Providers being released.

At the moment, my web.config sessionState section looks like this:

<sessionState mode="Custom"
              customProvider="TableStorageSessionStateProvider">
  <providers>
    <clear/>
    <add name="TableStorageSessionStateProvider"
         type="System.Web.Providers.DefaultSessionStateProvider"/>
  </providers>
</sessionState>

However, using this gives me an error as the provider needs to have a connectionStringName attribute.

For Azure table storage, what should this look like?

like image 971
Richard Ev Avatar asked Oct 08 '22 04:10

Richard Ev


2 Answers

I don't think the universal providers have any support for table storage.

like image 52
user94559 Avatar answered Oct 13 '22 10:10

user94559


Or you can use AppFabric Caching:

http://msdn.microsoft.com/en-us/library/windowsazure/gg278339.aspx

like image 20
Tom Avatar answered Oct 13 '22 10:10

Tom