IIS 7.0 - Application Pool Recycles - Log a event in Windows Event Log

This is my 1st blog post on IIS 7.0.

Application Logging

Apart from the standard IIS logs type, other items can be logged. Many of these options can be set in UI using the IIS Manager or by using Appcmd.exe - IIS command line administration Tool.

Application Pool - Process Recycling Logging

In IIS 7.0, events are logged to the Windows event log when an application pool recycles. You can control eight recycling application pool configuration settings with each option listed in Table below:

Recycling Options Under Generate Recycle Event Log Entry

Option

 

Description

 

Default Setting

 

Application Pool Configuration Changed

 

Event is logged when the application pool recycles due to a change in its configuration

 

No

 

ISAPI Report Unhealthy

 

Event is logged because an ISAPI extension has reported itself as unhealthy

 

No

 

Manual Recycle

 

Event is logged when the application pool has been manually recycled

 

No

 

Private Memory Limit Exceeded

 

Event is logged when the application pool recycles after exceeding its private memory limit

 

Yes

 

Regular Time Interval

 

Event is logged when the application pool recycles on its scheduled interval

 

Yes

 

Request Limit Exceeded

 

Event is logged when the application pool recycles after exceeding its request limit

 

No

 

Specific Time

 

Event is logged when the application pool recycles at a scheduled time

 

No

 

Virtual Memory Limit Exceeded

 

Event is logged when the application pool recycles after exceeding its virtual memory limits

 

Yes

 


In IIS Manage UI, you can find above options as below:

1. Open IIS Manager

2. Go application pools.

3. Highlight the application pool and select "Advanced Settings".

4. Under Recycling, Expand "Generate Recycle Event Log Entry"

AppPoolSettings 


Classic ASP Error Logging:

For Classic ASP (Active Server Pages) in IIS 7.0, you can configure options for logging ASP errors under the ASP section in the IIS Manager. You may use the following options to discover issues when migrating your Classic ASP applications to IIS 7.0.

  • Enable Log Error Requests - Controls whether the Web server writes ASP errors to the application event log
  • Log Errors To The NT Log - Specifies that ASP errors are recorded in the Windows event log

Note: These options are also available in IIS 6.0, but you have to use ADSUtil.vbs to enable them in the metabase. Now, in IIS 7.0, you can use the IIS Manager to enable these options or use command line appcmd.exe tool.

Logging ASP.NET Exceptions:

All ASP.NET 2.0 unhandled exceptions are always written to the Application Event log. Along with application pool recycle events or other errors in the event logs, this can be very helpful in troubleshooting application errors. It is always a good idea to debug Unhandled Exceptions in ASP.NET. See following blogs for more information:

Debugging Unhandled Exceptions in ASP.NET
Learning how to Debug ASP.NET App Issues (Memory Leaks, Crashes, Deadlocks, etc)


IIS 6.0 Events Reference
IIS logs events in the windows event viewer which helps to analyze performance and troubleshooting. Review "Event Reference" for more information.

4 Comments

  • Urgent,
    Easy-Cgi.com told us the new IIS web server does not like original IIS system. The new IIS system will not allow run any Cgi XXX.exe any more.
    So, huge customers of Easy-Cgi.com have complained and move to Apache Web Server.
    I am a programmer long time, I wonder why IIS 7 system cause many customers to use Apache system?

    Maybe, the Easy-Cgi.com technician did not control the new IIS system

  • sweet post! Welcome to blogosphere!

  • Provided IIS and CGI configured correctly, IIS should allow any cgi to execute
    Can you be more specific?

  • please help....
    Event code: 3005
    Event message: An unhandled exception has occurred.
    Event time: 09/01/2009 14:57:08
    Event time (UTC): 09/01/2009 14:57:08
    Event ID: fd6d4b908eb04415a6200e95763f7cfc
    Event sequence: 266
    Event occurrence: 11
    Event detail code: 0

    Application information:
    Application domain: /LM/W3SVC/1834850846/Root-4-128759770752693750
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\Inetpub\wwwroot\WEBSITEFOLDER\
    Machine name: SERVERXYZ

    Process information:
    Process ID: 640
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE

    Exception information:
    Exception type: IndexOutOfRangeException
    Exception message: Index was outside the bounds of the array.

    Request information:
    Request URL: https://SITENAME.COM/FILENAME.ASPX
    Request path: /FILENAME.ASPX
    User host address: HOST IP ADDRESS
    User: 1084
    Is authenticated: True
    Authentication Type: Forms
    Thread account name: NT AUTHORITY\NETWORK SERVICE

    Thread information:
    Thread ID: 13
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace: at System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean setTimeout)
    at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
    at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
    at System.Data.SqlClient.SqlDataReader.get_Item(Int32 i)
    at agents_aleft.Page_Load(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Ganesh Anekar THIS PROBLEM IS KEEP COMING ON MY ASP.NET WEBSITE WITH IIS 6 AND SP 2 AND ms SQL EXPRESS
    I COPY THIS INFO FROM EVENT LOG FROM THE SERVER. NO PROBLEM WITH CODE AND WITH SQL STATEMENTS. THERE IS SOME THING WITH W3WP.EXE PROCESS PLEASE HELP

Comments have been disabled for this content.