ASP.NET session state provider in Azure

8.4k views Asked by At

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?

3

There are 3 answers

8
David Makogon On BEST ANSWER

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.

3
Igorek On

IMHO: Azure AppFabric Caching Service. It's strategically where they're going and they'll likely be done with it before you finish development.

0
David Makogon On

As I mentioned in a comment above, the AppFabric Cache is now live, in production. Details, including pricing and SLA, are here. Highlights of the production release:

  • Availability in all data centers
  • Ability to consume cache from 128MB to 4GB
  • Transactional SLA (# of cache transactions per second)

Through the portal, once you create your cache namespace, you simply click a button that generates web.config/app.config snippets that you copy 'n' paste. It's that simple.