This documentation is archived and is not being maintained.

Viewing Trace Messages And Handling Asserts 

To view trace messages and assertion failures from ATL Server DLLs running in IIS

  1. Select the Custom assert and trace handling support check box on the Developer Support Options tab when you generate your ATL Server request handler or ISAPI DLL using the ATL Server Project Wizard


    Add the following code to one of the source files in your project:

    // For custom assert and trace handling with WebDbg
    #ifdef _DEBUG
    CDebugReportHook g_ReportHook;
  2. If you intend to view the messages from a remote machine, set the name of that machine as the one which will provide the debug pipe by passing it to the CDebugReportHook constructor or SetPipeName method:

  3. Use standard trace and assert macros, such as ATLTRACE or _ASSERTE, in your code.

  4. Build debug versions of your DLLs.

  5. Install the DLLs on your Web server.

  6. Run WebDbg.exe.

    WebDbg.exe is located in the \Common7\Tools folder of your Visual C++ .NET installation. This application provides a simple user interface for viewing trace messages and interacting with asserts.

    To use WebDbg.exe to view the call stack at the point that an assert is triggered, click the View menu and then click Stack Trace. This option is turned off by default.

    To set the permissions on the pipe, click the File menu and then click Permissions. If you are collecting debug information remotely or running your Web server using Medium or High application protection, make sure that the accounts of the Web processes you are interested in have permissions to access the debug pipe.


    The debug output is written using the security context of the process, so a typical Web application will write to the pipe using the SYSTEM or IWAM_MachineName accounts that are local to the Web server.

  7. Test your Web application using the desired clients.


    If there is no instance of WebDbg.exe running against the specified pipe and if a debugger is not attached to the server process, trace messages and assertion failures will not be recorded.

See Also