Project Description
Since Web Roles on Azure are state-less, you cant Load balance your web roles with sessions affinity.
To resolve this problem, with sql Azure Database, we can use a Custom Session provider for Sql Azure.
This a sample, with all source code to achieve this.
Steps to complete the sample :
1) Create the AspState database on Sql Azure
===> Script : AspState.sql
2) Change ConnectionString in Web.Config, section sessionState:
===> sqlConnectionString="Server=tcp:yourserver.ctp.database.windows.net;Database=ASPState;User ID=Administrator;Password=yourpassword;Trusted_Connection=False;"
* Change the server name : "yourserver"
* Change the Password : "yourpassword"
3) Change the setting in ServiceConfiguration.cscfg
===> <Setting name="AzureSessionProvider" value="Server=tcp:yourserver.ctp.database.windows.net;Database=ASPState;User ID=Administrator;Password=yourpassword;Trusted_Connection=False;" />
* Change the server name : "yourserver"
* Change the Password : "yourpassword"
4) Deploy :)