Configure an Application Pool to Recycle after Reaching a Number of Requests (IIS 7)

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

If you have an application that causes problems after reaching a certain number of requests, you can configure the application pool to recycle before reaching that number. Based on what you know about the application, you should configure the value to be less than the number of requests processed before application failure.

Prerequisites

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 Application Pools Feature Requirements (IIS 7).

Exceptions to Feature Requirements

  • None

To configure an application pool to recycle after reaching a number of requests

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. For information about opening IIS Manager, see Open IIS Manager (IIS 7).

  2. In the Connections pane, expand the server node and click Application Pools.

  3. On the Application Pools page, select an application pool, and then click Recycling in the Actions pane.

  4. Select Fixed number of requests, and in the corresponding box type the number of requests after which you want the application pool to recycle.

  5. Click Next, select the events that should be logged when an application pool recycles, and then click Finish.

Command Line

To configure an application pool to recycle after a specific number of requests, use the following syntax:

**appcmd set apppool /apppool.name:**string **/recycling.periodicRestart.requests:**uint

The variable string is the name of the application pool that you want to configure. The variable uint is an unsigned integer, which specifies the number of requests after which to recycle the application pool. For example, to configure an application pool named Marketing to recycle after fifty-five requests, type the following at the command prompt, and then press ENTER:

appcmd set apppool /apppool.name:Marketing /recycling.periodicRestart.requests:55

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

Configuration

The procedure in this topic affects the following configuration elements:

requests attribute of the <periodicRestart> element under <recycling>

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

WMI

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

  • ApplicationPool.Recycling.PeriodicRestart.Requests property

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

Concepts

Configuring Recycling Settings for an Application Pool (IIS 7)
Managing Application Pools in IIS 7