Friday, December 11, 2015

What happens when Enable-SPSessionStateService -DefaultProvision


Powershell command
Enable-SPSessionStateService -DefaultProvision 
The changes to the SQL server and web site are as follows:
1) SQL server
In the sql server a new Database will be created as 
"SessionStateService_706b1a65e15248618a0090cd50ed1823"
2) Web.config changesIn the web.config file he below entry is inserted

<system.web>
...
<sessionState mode="SQLServer" timeout="60" allowCustomSqlDatabase="true" sqlConnectionString="Data Source=shaamils_SqlServer;Initial Catalog=SessionStateService_706b1a75e15248618a0090cd60ed4813;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15" />
</system.web>

<modules runAllManagedModulesForAllRequests="true">
...
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>

IIS settings for Session State Managemnt

This might be useful when deciding on how to manage session state in a web application. Bu default session sate is set to "InProc" in IIS. In scenarios where you might have to persists the state in DB for instance Oracle DB you have to code your own session state provider. In such cases the IIS session state has to be changed to "Custom" as below.