Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Debugging ASP.NET Web Services

Debugging ASP.NET Web Services

Visual Studio .NET 2003

Debugging an XML Web service created with ASP.NET is similar to debugging an ASP.NET Web application. For more information, see Debugging ASP.NET Web Applications. You can perform many of the same operations, such as setting breakpoints, stepping through code, and viewing the state of your program using various debugger windows.

When a managed client calls a managed XML Web service, the Visual Studio .NET debugger can automatically step between the client and the XML Web service. For details, see Stepping Into an XML Web Service.

The following sections explain some useful techniques for debugging XML Web services:

Debugging an XML Web Service on http://localhost

During development, you may want to debug an XML Web service on http://localhost rather than a remote server. For more information, see Debugging a Deployed XML Web Service.

To debug an XML Web service during development

  1. If you have not already done so, set the debug mode attribute in the application's Web.config configuration file. For more information, see Debug Mode in ASP.NET Applications. Debug mode tells ASP.NET to generate symbols for dynamically generated files and enables the debugger to attach to the ASP.NET application. (Projects created from the XML Web service template should have this set automatically.)
  2. In Visual Studio .NET, use the <Project> Property Pages to set the project properties for XML Web service debugging.
  3. To start debugging the XML Web service, choose Start from the Debug menu.

    Visual Studio .NET builds the XML Web service project and deploys the application and its symbol information.

  4. Use the debugger to set and clear breakpoints, step, and perform other debugging operations, as you would for any application. For more information, see Using the Debugger.
  5. To end the debugging session in Visual Studio .NET, choose the Stop Debugging command on the Debug menu or, in Internet Explorer, choose Close from the File menu.

Debugging an XML Web Service on a Remote Server

With the Visual Studio .NET debugger, you can debug an XML Web service transparently on the local machine or a remote server. This means that the debugger functions the same way and allows you to use the same features on either machine. For remote debugging to work properly, however, there are some prerequisites.

  • Visual Studio .NET remote debugging components must be installed on the server you want to debug. (For more information, see Setting Up Remote Debugging.)
  • In C/C++, the project must be set up to connect using DCOM rather than TCP/IP. To set this property, you must open the <Project> Property Pages dialog box and choose Remote via DCOM for Connection. (For more information, see Project Settings for a C or C++ Debug Configuration.)
  • By default, the ASP.NET process (aspnet_wp.exe for IIS5.0 and IIS 5.1 on Windows 2000 and Windows XP or w3wp.exe on IIS6 on Windows Server 2003) runs as an ASPNET process. As a result, you must have Administrator privileges on the machine where ASP.NET runs to debug it.
  • The remote server must grant the debugger access. To grant access to a user, you must add the user to the Administrators group on the server. (If the ASP.NET worker process is running under your the user's own account, you can add the user to either the Administrators group or the Debugger Users group.)

To add a user to the Debugger Users group on a server

  1. Log onto the server as Administrator.
  2. Right-click My Computer and choose Manage from the shortcut menu.
  3. Under System Tools, Local Users and Groups, open the Groups folder.
  4. Double-click Debugger Users.
  5. In the Debugger Users Properties dialog box, you will see a list of members. If the user does not appear in the Members list, click the Add button.
    • In the Select Users or Groups dialog box, select the name of the user you want to add from the list and click Add.


    1. Type the name of the user in the lower box.
    2. Click OK.
  6. Click OK.
  7. You need to restart your computer for the changes to take effect.

For more information about adding users and groups, click the Help button at the top of the Computer Management console.

Error: Error While Trying To Run Project

If you are not a member of Debugger Users on the remote server, you will get the following error message when you try to debug:

Error while trying to run project: Unable to start debugging on the Web server. Access is denied. Check the DCOM configuration settings for the machine debug manager. Would you like to disable future attempts to debug ASP.NET pages for this project.

Debugging a Deployed XML Web Service

Sometimes, you may need to debug an XML Web service that is already deployed and running on a server. To debug a deployed and running XML Web service from Visual Studio .NET, you must attach to the ASP.NET worker process (aspnet_wp.exe for IIS5.0 and IIS 5.1 on Windows 2000 and Windows XP or w3wp.exe on IIS6 on Windows Server 2003). To attach to the ASP.NET worker process, follow the steps in this procedure:

To debug a deployed XML Web service

  1. From the Debug menu, choose Processes.

    The Processes dialog box appears. For more information, see Processes Dialog Box. The following steps are performed in this dialog box.

  2. If the XML Web service is running on a remote server, select the remote machine.
  3. Select Show System Processes.
  4. In the Available Processes list, choose the process aspnet_wp.exe or w3wp.exe.
  5. Click the Attach button.
    1. In the Attach to Process dialog box, make sure Common Language Runtime is selected in Choose the program types that you want to debug.
    2. Click OK.
  6. At the bottom of the Processes dialog box is a drop-down list box labeled When debugging is stopped. From this list, you can choose whether to terminate or detach from the process when you stop debugging. The default setting is Detach from this process, which resumes all threads in the process when debugging stops. If you choose Terminate this process, the aspnet_wp.exe or w3wp.xee process terminates when debugging stops. Terminating the aspnet_wp.exe or w3wp.exe process will affect all ASP.NET applications running on the server, so this is not something you want to do in most cases.
  7. Click OK.

    The next time that the application breaks, a dialog box appears asking for the location of the application's source files. Use this dialog box to locate the source. The filename you specify in the dialog box must match the filename specified in the debug symbols (located on the Web server).

See Also

Debugging an ASP.NET Web Application | Timeout While Debugging XML Web Services

© 2015 Microsoft