I am trying to find difference between inproc and outproc in c#. If I have a dll running on the server and my question is will it run in both inproc and outproc? Performance-wise which process is better?
InProc session mode indicates that session state is stored locally. This means that with InProc session state mode is 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 IIS) or the AppDomain restarts.
Outproc session state This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. Calling an outproc server , data needs to be marshalled across the process boundry which is an expensive operation.
By default, sessions are stored in-proc (in-process); i.e. in the memory of the Web Server.
An inproc server runs in the same process as the calling application. It's close to a normal function call on a dll. Calling an outproc server, data needs to be marshalled across the process boundry which is an expensive operation. An inproc server is fast but it can bring down your application.
From MSDN
ASP.NET session state supports several different storage options for session data. Each option is identified by a value in the SessionStateMode enumeration. The following list describes the available session state modes:
InProc mode, which stores session state in memory on the Web server. This is the default.
StateServer mode/OutProc, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
Custom mode, which enables you to specify a custom storage provider. Off mode, which disables session state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With