Wednesday, January 20, 2010

Debuggin IIS crashes/hangs

  • Download the IIS Debug Toolkit

  • Use the GUI or the command line to enable Pageheap.exe:
    To use the GUI, follow these steps:
    a. Run Gflags.exe.
    b. For Image File Name, type the name of the process that you want to debug. For an IIS 5.0 Web site, the name of this process is Inetinfo.exe, Dllhost.exe, or Aspnet_wp.exe. For an IIS 6.0 Web site, the name of this process is Inetinfo.exe or W3wp.exe.
    c. Under Destination, click the Image File Options option.
    d. In the lower pane of the Global Flags dialog box, click Enable page heap.
    e. Click Apply, and then click OK.
    To use the command line, follow these steps:
    a. Switch to the folder where the IIS Crash/Hang Agent is installed.
    b. Run the following command:
    gflags –p /enable Process Name
    NoteFor IIS 5.0, Process Name is Inetinfo.exe, Dllhost.exe, or Aspnet_wp.exe. For IIS 6.0, Process Name is Inetinfo.exe or W3wp.exe.
    3. If the targeted process is Inetinfo.exe, use the Iisreset command to restart IIS. To do this, follow these steps:
    a. Click Start, click Run, type Cmd, and then click OK.
    b. At the command prompt, type Iisreset computername /restart, and then press ENTER.
    Replace computername with the name of your IIS server.
    If the targeted process is Dllhost.exe or Aspnet_wp.exe, unload and then reload the Web application (you do not have to restart IIS).
    4.Attach the debugger to the targeted process:
    a. Switch to the folder where you installed the IIS Crash/Hang Agent and the IISDump tools.
    b. At a command prompt, run the following command:
    iisdump.exe –I –p [PID of Targeted process]
    When the corruption occurs, a breakpoint exception dump file or a second chance access violation dump file is created. You must use the Windows debugger (Cdb.exe or Windbg.exe) to analyze the dump file so that you find the cause of the corruption.

    Remember that in certain circumstances, Pageheap.exe may not help find the cause of the corruption when Pageheap.exe is running in NORMAL mode. If this occurs, run Pageheap.exe in FULL mode.

    When you complete the debugging, you can disable Pageheap.exe. To do this, either click to clear the Enable Pageheap check box in the Gflags GUI, or run the following command at a command prompt:
    gflags –p /disable Process Name
    Note For IIS 5.0, Process Name is Inetinfo.exe, Dllhost.exe, or Aspnet_wp.exe. For IIS 6.0, Process Name is Inetinfo.exe or W3wp.exe.

    Note Running Gflags with the –p switch is the same as running Pageheap.exe. For example, both of the following commands cause Pageheap.exe to run in NORMAL mode for the Inetinfo.exe process:
    Gflags –p /enable inetinfo.exe
    Pageheap.exe /enable inetinfo.exe

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home