Share via

Enable In-Process Session State (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

The in-process session state mode stores session-state data for an ASP.NET application in the worker process where the application runs. This mode is the default for IIS 7.

The advantage of using in-process session state is that it provides the fastest access to session-state data. However, as you store more data in a session, you consume more Web server memory, which can slow server performance.

Before you configure in-process session state, you should consider the effect of worker process recycling on session state data. If the worker process recycles, all session state data is lost. If your ASP.NET applications need to preserve session-state data, and if speed of access to the data is not your primary objective, consider using an out-of-process session state mode for storing this data.


The Windows state service (Aspnet_state.exe) must be running for in-process session state to take effect. By default, this service is installed when Windows ServerĀ® 2008 is installed and is configured for manual start. It is recommended that you change the start behavior to Automatic.


For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Session State Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To enable in-process session state for a Web server

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

User Interface

To Use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click Session State.

  3. On the Session State page, in the Session State Mode Settings area, click In process.

  4. (Optional) Configure cookie settings in the Cookie Settings area on the Session State page.

  5. (Optional) Check the Use hosting identity for impersonation check box to use Windows authentication and the host process identity (either ASP.NET or a Windows service identity) for remote connections.

  6. Click Apply in the Actions pane.


To enable in-process session state, use the following syntax:

appcmd set config /commit:WEBROOT /section:sessionState /mode:InProc

The variable mode:InProc enables in-process session state. By default, in-process session state is enabled.


When you use Appcmd.exe to configure the <sessionState> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).


The procedure in this topic affects the following configuration elements:

  • <sessionState>

  • <sessionPageState>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.


Use the following WMI classes, methods, or properties to perform this procedure:

  • SessionStateSection.Mode property "InProc" flag

For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.

See Also


Configuring Session State in IIS 7