Debugging ISAPI Extensions and Filters
There are several ways to establish an environment for debugging your ISAPI extensions and filters. ISAPIs can be debugged using a debugging tool that can attach to a running process, such as Visual Studio, or a debugging tool that must be launched at the same time as the ISAPI.
To debug an ISAPI extension using Visual Studio
Start the IISADMIN process if it is not already started. This can be done from the command line with the following command:
net start iisadmin
Start the W3SVC service if it is not already started. This can be done from the command line with the following command:
net start w3svc
Use a client like Internet Explorer to request your ISAPI extension.
Launch Visual Studio. In the Build menu, click Start Debug and click Attach to Process.
Select the Show System Process check box. If your ISAPI extension is running in the IIS process, select the Inetinfo.exe process from the list and click OK.
To debug an ISAPI extension using a debugging tool that cannot attach to a running process
In the Control Panel, double-click Administrative Tools, double-click Component Services.
In the Component Services window, click Services.
In the list of local services, right-click IIS Admin and click Properties.
In the Log On tab, click the Local System account button, and select the Allow service to interact with desktop check box and click OK.
Repeat steps 3 and 4 for all processes that run under the IIS Admin process, for example the World Wide Web Publishing Service and the FTP Publishing Service.
Open the Registry Editor. This can be done with the following command:
start regedit
In the Registry Editor, browse to the to HKEY_LOCAL_MACHINE/Software/Microsoft/WindowsNT/CurrentVersion/Image File Execution Options key. Right-click that key, click New, and click Key. Type the name Inetinfo.exe as the new key name.
Right-click the Inetinfo.exe key, click New, and click String Value. Type Debugger as the new string value name. Click Debugger to edit the string value. Type in the full path to the debugger that you want to use, for example, C:\Program Files\Debugging Tools for Windows\cdb.exe.
When the World Wide Web Publishing Service is started, your debugger will also be launched. You can now set appropriate breakpoints in your ISAPI extension.You will not be able to set breakpoints in a component's source code until the extension has been loaded into memory. For ISAPI extensions, you will need to start Internet Explorer and request the ISAPI URL. As soon as the page is loaded, you should be able to set breakpoints in your component. Refresh the page to trigger the breakpoints you selected. If the extension or filter cannot be loaded even once, for instance, if the fault occurs in component startup code, you will need to load the ISAPI DLL prior to starting the debugging session.