Store Asp.net Sessions in MS SQL Server
Website users are being automatically logged out after being inactive for a period of time. The DotNetNuke event log may show this issue:
This is a by-design feature of your website. This occurs when your ASP.NET application pool recycles. The "AppDomain shut down because of the hosting environment" message does not mean that your site is offline, it simply means the site has not been accessed in a while and ASP.NET is uncaching it to preserve resources.
To fix this problem, your website must be configured to use the SQL Server as the session state. Please follow these directions to do that. If you do not have a dedicated server this fix must be implemented by a support technician.
Shutdown Details: The AppDomain shut down because of the hosting environment.
The ASP.NET session state will now be stored in your website's database and will not be lost after the application pool recycles.
- Connect to the server using Remote Desktop.
- Click Start > Run and type cmd into the run dialogue box.
- Copy and paste the following command into your command prompt replacing [databasename] with the name of your sites database:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql -ssadd -sstype c -d [databasename] -E
- Open the web.config of the site.
- Right before the </system.web>, update the SESSIONSTATE node as follows:
Article ID: 591, Created: April 10, 2012 at 9:56 AM, Modified: August 26, 2014 at 9:17 AM