Debug an ISAPI DLL in the IIS 6.0 with BDS 2006 by attaching to the W3WP.exe Process


Preparation:
 
Install BDS 2006 on the machine, where the IIS 6.0 is installed.

Create a new virtual directory in the IIS 6.0 and set the output path of your ISAPI DLL to this folder.
 
Create a new Application Pool in the IIS 6 Administration. Disable “Recycle Worker Processes” and set “Number of worker processes“ to 1 in the properties of the new Application Pool.
image002image004
 
Configure your virtual Directory  to use the new Application Pool
image006
 

Add the User, which you use to run BDS 2006 to the local Usergroup “Debugger Users”
image008
 
Enable “Remote Debug Symbols” in the Linker Options of your Application
image010
 
 Set the “Output directory” to the Folder of the virtual directory in the IIS 6.0. Please type “\\?\” in before the path, when you are using BDS 2006
image012
 
Adjust the Run…Parameters of your ISAPI DLL with the following parameters
Host Application: “C:\WINDOWS\system32\inetsrv\w3wp.exe”
Parameters: “-debug”
Working directory: The folder of your virtual directory
 
image014
 
Start debugging:
 
Stop the “Worldwide Web Publishing Service” by typing “NET STOP W3SVC” in a command prompt. I suggest you create a batch file with this command and place it on your desktop or in the Delphi Tools Menu, so that you can access it easy.
 
 
Hit Run…
 
A command prompt window appears, running the W3WP.exe
image016
 
Now you should be able to set active breakpoints in the Sourcecode.
 
Note: This setup doesn’t seem to work in a RDP Session, you either need to work directly on the Console of the Server 2003, via VNC or connect with RDP to the Servers console. If you have none of this options, you might try the Web App Debugger