Establishing a Debugging Environment

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

  1. Start the iisadmin process. This can be done from the command line with the command net start iisadmin. You can also use the Services application in Control Panel to start the IIS Admin Service, which will start the iisadmin process.
  2. Run Visual Studio and select the Attach to Process command from the Start Debug submenu of the Build menu.
  3. Select 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. You can also use the Services application in Control Panel to start the World Wide Web Publishing Service.

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

  1. Start the Services application in Control Panel.
  2. Select the IIS Admin service and click Startup.
  3. Select the Allow Service to Interact with Desktop check box and click OK.
  4. 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.
  5. Use the Registry Editor to add a subkey named Inetinfo.Exe to the HKEY_LOCAL_MACHINE/Software/Microsoft/WindowsNT/CurrentVersion/Image File Execution Options key.
  6. 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 run as well. 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 component has been loaded into memory. First, you will need to start Internet Explorer and view the ASP page containing the object. As soon as the page is loaded, you should be able to set breakpoints in your component. Click Refresh to view the page again, and trigger the breakpoints you selected. If the component cannot be loaded even once (for instance, if the fault occurs in component startup code), you will need to load the component DLL prior to starting the debugging session. (See step 11 in the following topic.)