Search code examples
asp.net-mvc-3azureappfabric

Best Practices: Using Session in Windows Azure with multiple instances


Can anyone tell me that if I use Session(inside an ASP.NET MVC 3 application) in Windows Azure environment with multiple instances(means multiple virtual machines), then it work without any configuration or I need to use ASP.NET Universal Providers or I need to handle this manually by using AppFabric?


Solution

  • You can't use in-process session state, but must use a shared session state provider.

    The only supported session state model is to use Azure Cache, but you can use a provider that works with either Azure Storage or SQL Azure.

    UPDATE:

    I wrote some articles on my blog which go into using SQL Azure for session state with Entity Framework Code First. Hopefully, you'll find useful pointers there, even if you're not using Entity Framework.

    Something to bear in mind using the standard SQL Server Session State Provider is that it doesn't have the retry logic which is considered good practice when working with SQL Azure.