次の方法で共有


Configure Logging of Events when an Application Pool Recycles because of Configured Recycling Events (IIS 7)

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

You can configure IIS to log an event when one or more of the following configured events cause an application pool to recycle:

  • Scheduled Time: You configure an application pool to recycle at a certain time of day.

  • Regular time intervals: You configure an application pool to recycle after a specified time.

  • Number of Requests: You configure an application pool to recycle after reaching a certain number of requests.

  • Virtual Memory Usage: You configure an application pool to recycle after you use a specified amount of virtual memory.

  • Memory Usage: You configure an application pool to recycle after you use a specified amount of memory.

You can then view the log to determine when or how frequently an application pool recycles because of configured events. This can help you troubleshoot problems on the server, such as applications that have memory leaks or applications that fail after reaching a certain number of requests.

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 logging of events when an application pool recycles because of configured recycling events

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 Edit Application Pool area in the Tasks pane.

  4. On the first page of the Edit Application Pool Recycling Settings wizard, click Next.

  5. To log configured recycling events, in the Configurable recycling events area, select one or more of the following check boxes:

    • Regular time intervals

    • Virtual memory usage

    • Number of requests

    • Scheduled time(s)

    • Private memory usage

Note

Only recycling options that you enable on the previous page are enabled on the logging page.

  1. Click Finish.

Command Line

To configure IIS to log an event when an application pool recycles because of a non-configured event, use the following syntax:

appcmd set config /section:applicationPools /[name='string'].recycling.logEventOnRecycle:PrivateMemory|Memory|Schedule|Requests|Time

The variable string is the name of the application pool that you want to configure. For example, to configure IIS to log an event when an application pool named Marketing recycles because reaches a specified number of requests, type the following command at the command prompt, and then press ENTER:

appcmd set config /section:applicationPools /[name='Marketing'].recycling.logEventOnRecycle:Requests

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

Configuration

The procedure in this topic affects the following configuration elements:

logEventOnRecycle attribute of the <recycling> element

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

WMI

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

  • ApplicationPool.Recycling.LogEventOnRecycle 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