ASP.NET session state provider in Azure

vtortola picture vtortola · Feb 8, 2011 · Viewed 8.1k times · Source

As far as I know, the current situation is this:

  1. Use SQL session state provider is possible (as I've read somewhere) but it's not supported by Microsoft. So it could stop working in the future. Also it needs a WorkerRole to delete the outdated data.
  2. Azure AppFabric Caching Service is still in CTP.
  3. TableStorageSessionProvider is a piece of code in the Azure training kit that is not recommended for production code.

What would you choose?

Answer

David Makogon picture David Makogon · Feb 8, 2011

If you're going live this week, I'd recommend the SQL Azure session state provider. There's an excellent blog post here that provides everything you'll need.

You're correct in that this solution isn't officially supported by Azure. However, it should work fine for now, and you can very easily shift to Azure AppFabric Caching (as suggested by Igor) once that goes live.

**EDIT 6/16/2014 ** See Azure Redis Cache (Preview) ASP.NET Session State Provider section of MVC movie app with Azure Redis Cache in 15 minutes

EDIT 5/23/2012 Lots of changes since this answer. As of August 2011, cache in SQL Azure is officially supported, via Universal Providers. See more info on this blog post. Pricing starts at $4.99 for a 100MB database.

AppFabric Cache is live as of May, 2011. Cache starts at 128MB for $45. Details of the AppFabric Cache are here. Note that there are hourly quotas in place on number of transactions, number of connections, and bandwidth (as well as storage capacity).

EDIT 6/7/2012 Yet another update: With the Spring 2012 release, there's now the ability to create a cache using a percentage of RAM in your existing Web or Worker roles (costing nothing), as well as a new Cache Role to create dedicated high-speed cache within your deployment (for the cost of the instances). Scott Guthrie blogged about it here. These features are available in the new v1.7 SDK.