InProc Session State & Out Proc Session State In ASP.NET

Apr 29 2010 9:17 AM

InProc Session State

InProc session mode indicates that session state is stored locally. This means that with InProc session state mode is actually stored as life objects in the AppDomain of the Web application. This is why the session state is lost when Aspnet_wp.exe (or W3wp.exe, for applications that run on Microsoft Internet Information Services [IIS] 6.0) or the AppDomain restarts.  

Session Data Is Lost When You Use ASP.NET InProc Session State Mode.

Session state data is lost if the AppDomain or the Aspnet_wp.exe process (or the W3wp.exe process, for applications that run on Microsoft Internet Information Services [IIS] 6.0) is recycled. Generally, the AppDomain is restarted based on several factors:

Various attributes (for example, the memoryLimit attribute) have particular settings in the <processModel> section of the configuration file.

The Global.asax or the Web.config file was modified.

The Bin directory of the Web application was modified.

To work around this problem, you can use StateServer or SqlServer session state mode. ASP.NET provides these other approaches for storing session state data. In the StateServer and SqlServer modes, your session state is not stored in the AppDomain of the Web application.

OutProc Session State

In OutProc Session ,Sessin State is stored In the StateServer and SqlServer modes, your session state is not stored in the AppDomain of the Web application.1.StateServer: Alternately, StateServer mode uses a stand-alone Microsoft Windows service to store session variables. Because this service is independent of Microsoft Internet Information Server (IIS), it can run on a separate server. You can use this mode for a load-balancing solution because multiple Web servers can share session variables. Although session variables are not lost if you restart IIS, performance is impacted when you cross process boundaries.
2.SqlServer: If you are greatly concerned about the persistence of session information, you can use SqlServer mode to leverage Microsoft SQL Server to ensure the highest level of reliability. SqlServer mode is similar to out-of-process mode, except that the session data is maintained in a SQL Server. SqlServer mode also enables you to utilize a state store that is located out of the IIS process and that can be located on the local computer or a remote server.


Answers (1)