Establishing a Debugging Environment

There are several ways to establish an environment for debugging your ISAPI extensions and filters. If you are using a debugging tool capable of attaching to a Windows process, you can use this functionality to debug your component or extension. For example, if you are debugging an ISAPI extension with Microsoft Visual Studio you should take the following steps.

  1. Start the iisadmin process. This can be done from the command line with the command net start iisadmin.
  2. Launch Visual Studio and select the Attach to Process command from the Start Debug submenu of the Build menu.
  3. Click the Show System Process check box.
  4. Select the inetinfo process from the list and click OK.
  5. Start the W3SVC service. This can be done from the command line with the command net start w3svc.

If the debugging tool you are using is not capable of attaching to a Windows process, you should take the following steps to establish an appropriate debugging environment.

  1. Double click Administrative Tools in the Control Panel.
  2. Double click Component Services.
  3. Select Services in the Component Services Explorer.
  4. Select the IIS Admin service and click the Properties button.
  5. Click the Log On tab.
  6. Select the Allow service to interact with desktop check box and click OK.
  7. Repeat steps 2 and 3 for all processes that run under the IIS Admin process, for example World Wide Web Publishing Service, and FTP Publishing Service.
  8. Use the Registry Editor to add a subkey named inetinfo.exe to the HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/Image File Execution Options key.
  9. Add the following entry to this new key:
    Debugger = DebuggerExeName

where DebuggerExeName is the full path to the debugger you are using.

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 won't 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. (See step 5 of the following procedure.)