There is a KB article about How to generate a dump file when ASP.NET deadlocks in IIS 6.0. Please refer to http://support.microsoft.com/kb/828222 . This is not only applied to deadlock issue in IIS 6. Some errors only happen in a production environment. Killing worker processes ensures up-time but troubleshooting of these errors becomes difficult, e.g. if the failing worker process needs to be debugged. The process orphaning feature in WAS allows worker processes to be recycled without killing the failed worker process. Now a debugger can be attached to it. Additional process orphaning settings allow the execution of a process (e.g. a debugger) if orphaning happens.
Download Debugging Tools for Window(WinDbg)
You can download and install Windbg by installing WDK according to your system version from the link as below.
Create a batch file to execute when a worker process is orphaned
- Start Notepad
- Paste the following code into Notepad.
@if "%_echo%"=="" echo off
set TIMESTAMP=%TIMESTAMP: =_%
set COMMAND=c:\debuggers\cdb.exe -c ".dump /o /ma %FILENAME%;q" -p %1
echo %COMMAND% > %LOG%
- Save the file as action.cmd to “c:\action.cmd” or other path.
Note You may have to modify the location of the debuggers and the location where you want the resulting dump file to be generated.
Configure the Orphan Worker Process settings
For IIS 6, you can configure process orphaning as below.
- At the command prompt, type the following command, and then press ENTER:
- To enable the Orphan Worker Process feature, type the following command at the command prompt:
Note: Replace the DefaultAppPool as the Problematic application pool name.
adsutil.vbs SET W3SVC/AppPools/DefaultAppPool/OrphanWorkerProcess TRUE
- At the command prompt, set the executable to run when a process is scheduled to be recycled. For example, in this case use the batch file that was created in the “Create a Batch File to Execute When a Worker Process Is Orphaned” section:
adsutil.vbs SET W3SVC/AppPools/DefaultAppPool/OrphanActionExe "c:\action.cmd"
adsutil.vbs SET W3SVC/AppPools/DefaultAppPool/OrphanActionParams "%1%"
Note Make sure that the OrphanActionExe option points to the location of the batch file that was created in the “Create a Batch File to Execute When a Worker Process Is Orphaned” section. Also make sure that the identity of the W3wp.exe process has Read and Execute permissions to this file.
For IIS7 or above version, you can open IIS Manager to configure this feature directly.
1. Select your application pool and click Advanced Settings as below.
2. Then you can set the Process Orphaning parameters here.
Note Make sure that the Executable option points to the location of the batch file that was created in the “Create a Batch File to Execute When a Worker Process Is Orphaned” section. Also make sure that the identity of the W3wp.exe process has Read and Execute permissions to this file.
Charles from APGC DSI Team