How to debug InProc COM components inside IIS using WINDBG (192754)



The information in this article applies to:

  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Server 5.0
  • Microsoft Active Server Pages
  • Microsoft Visual Studio, Enterprise Edition 6.0
  • Microsoft Visual Studio 97

This article was previously published under Q192754

SUMMARY

This article explains how to use WinDbg in case of an Active Server Pages (ASP) 'ASP0115 Access Violation' error during the execution of a custom component that is written in Visual C++ or Visual Basic.

You can use WinDbg to further debug the component to find the actual line of code that the component is failing on.

MORE INFORMATION

Install WinDbg from the Microsoft Platform SDK.

Follow the instructions below for running it. Turn off Code Optimization in your compiler and compile the debug version with the .pdb files. The debug symbols (.pdb files) for your custom component should be placed in the same folder as the .dll file, and when you use WinDbg make sure the source files for your component are available on the server. To use WinDbg, follow these steps:
  1. Install WinDbg from the Microsoft Platform SDK.
  2. Start WinDbg. From the Debug menu, click Attach to A Process. Select the correct Process ID (PID) from the Process List:InetInfo PID:
    If the Web application is running in the same memory space as InetInfo, select Inetinfo.exe from the Process List.

    MTX PID:
    If the Web application has been set up to run in a separate memory space, the process will be an instance of Mtx.exe. There may be multiple instances of Mtx.exe in the Process List, so you can use one of the two methods outlined below to identify the appropriate process to attach to.
    • If the Web site is being hosted on a computer that is running Windows NT 4 with Service Pack 4, you can use the Script Debugger to obtain the processID of the appropriate instance of Mtx.exe. To do this, open the Script Debugger's Running Documents window. The root folder for each isolated application is listed, along with the processID of the appropriate instance of Mtx.exe.
    • If the Web site is being hosted on a computer running Windows NT 4 with Service Pack 3 or earlier, you will need to use a special utility to determine the processID. The IIS Resource Kit for IIS version 4.0 includes a utility called "GetPID" that you can use to identify the Process ID for an isolated application.
  3. From the Debug menu, click Exceptions, and then double-click Access Violation.
  4. Select Action = 'Enabled', and then click OK.
  5. Generate the Access Violation by connecting to the Web site.
  6. The dialog box will prompt you for the source code. Browse to the source code and then select either the .cls file or the .cpp file. The WinDbg debugger should now open another window, showing the line on which the component access violated highlighted in yellow.

REFERENCES

For more information on remote debugging with WindDbg, click the following article numbers to view the articles in the Microsoft Knowledge Base:

121543 Setting up for remote debugging

148954 How to set up a remote debug session using a modem

151981 How to set up a remote debug session using a null modem cable

148659 How to set up Windows NT Debug Symbols

For more information on debugging components, see the following Knowledge Base articles:

166275 How to debug a native code Visual Basic component in VC++

183480 How to debug ISAPI DLLs under IIS 4.0 and IIS 5.0


Modification Type:MajorLast Reviewed:5/29/2006
Keywords:kbBug kbDebug kbhowto KB192754