Session variables with multiple instances on windows Azure
.net, asp.net-mvc-3, azure, azure-sql-database, c#
Solution
The problem you're experiencing is due to the fact the session data is stored locally on a server (this is called InProc by ASP.NET). When you're using multiple instances this data isn't shared between the instances. In order to accomplish this you have a couple of choices:
- Store the session data in a SQL Azure database.
- Store the session data in Azure's table storage.
- Store the session data in Azure's caching service (probably the fastest, but also the most expensive).
Here's some more info: http://acloudyplace.com/2012/02/managing-session-state-in-windows-azure-what-are-the-options/
Problem
I'm working on an MVC3 Project and SQL Azure database. when i deploy more than 1 instance i get some problems with the sessions variables. To be more clear, i store the results of a table in a session variable and i pass the results to the model, the user can modify and manipulate the data until he clicks the "save" button. When the user clicks "Save" i obtain the new values from the model and pass them to the BLL and DAL layers for update the database. I dont know if this is the right solution !! but the client won't hit the database on every data changing. Help please.