Debug Application Pool Failures

Applies To: Windows Server 2003, Windows Server 2003 with SP1

To enable orphaning of a worker process serving an application pool (which keeps failed applications running while your diagnostic tools monitor them), and to attach a debugger to the worker process, you must change the values of three metabase properties. The values of these metabase properties, which are set by running a script, must specified as follows:

  • Set the OrphanWorkerProcess metabase property to TRUE to notify the WWW service to orphan the worker process when it fails.

  • Set the OrphanActionExe metabase property to specify an executable to run when the worker process is orphaned.

  • Set the OrphanActionParams metabase property to configure command-line parameters for attaching the debugger to the worker process.

Consider the following guidelines when you enable debugging of application pool failures:

  • Debugging requires that you set all three metabase properties outlined above; enabling debugging is ineffective until you attach a debugger.

  • When you no longer want to use the debugging feature, disable it. Putting an application in orphan state wastes resources if the diagnostics are not running or will not be used.

Requirements

  • Iis.msc.

Recommendation

As a security best practice, log on to your computer using an account that is not in the Administrators group, and then use the Run as command to run IIS Manager as an administrator. At the command prompt, type **runas /user:**administrative_accountname mmc %systemroot%\system32\inetsrv\iis.msc.

Procedures

To enable and configure debugging on a worker process

  1. Copy the following ADSI script (written in VBScript) into a text editor or word processor.

    set appPoolObj=GetObject("IIS://localhost/W3svc/AppPools/app pool name")
    ' Set the application pool properties:
    appPoolObj.Put "OrphanWorkerProcess", TRUE
    appPoolObj.Put "OrphanActionExe", "full path\ntsd.exe"
    appPoolObj.Put "OrphanActionParams", "-g -p %1%"
    ' Save the property changes in the metabase:
    appPoolObj.SetInfo
    WScript.Echo "After: " & appPoolObj.OrphanWorkerProcess & ", " & appPoolObj.OrphanActionExe & ", " & OrphanActionParams
    
  2. Save the file with the extension .vbs.

  3. In the Run dialog box, type cmd, and then click OK.

  4. At the command prompt, run the script by typing the following command:

    cscript //nologo filename

    where filename is the fully qualified path of the script file.

    – or –

    You can call the script by using a batch file that contains the following command:

    "cscript //nologo filename"
    

    where filename is the fully qualified path of the script file.