Partilhar via


Debugging Preparation: XML Web Service Projects 

The XML Web Service project template creates the default project settings for debugging. For more information, see How to: Create ASP.NET Web Service Projects.

It is also necessary to configure the web.config file to enable debugging. This can be configured manually or automatically. For more information, see How to: Enable Debugging for ASP.NET Applications.

To begin debugging, choose Start from the Debug menu. If you did not manually enable debugging, the Debugging Not Enabled dialog box will appear, which will give you the choice of having a web.config file automatically created with debugging enabled, or running without debugging. After this dialog box closes, the project settings cause Visual Studio to launch the browser selected in the <Project> Properties Pages and to dynamically generate a test page. On the test page, you can enter commands and observe the data that is returned by your XML Web service.

Debugging an XML Web Service from a client application

There are two methods to debug an XML Web service from a client application.

To debug by a client application and XML Web server (method 1)

  1. In Visual Studio, create a new XML Web Service project.

    For more information, see How to: Create ASP.NET Web Service Projects.

  2. On the Debug menu, click Start to run the XML Web service.

    This step not only allows you to test whether the web service is working, it also creates the web.config file, which is necessary for debugging.

  3. On the Debug menu, click Stop Debugging.

  4. Create a client application project in the same solution as your XML Web Service project. To do this, on the Debug menu, click Add New Project.

  5. In Solution Explorer, right-click the client project, and click Properties on the shortcut menu.

  6. In the Solution <Name> Properties window, open the Common Properties node, and select Startup Project.

  7. Click Multiple Startup Projects.

  8. Under Multiple Startup Projects, go to the Action column and set the action to Start for both projects.

  9. Click OK to close the Solution <Name> Properties window.

  10. On the Debug menu, click Start to debug both the client application and XML Web server.

To debug by stepping from a client application into an XML Web server

  1. In Visual Studio, create a new XML Web Service project.

    For more information, see How to: Create ASP.NET Web Service Projects.

  2. On the Debug menu, click Start to run the XML Web service.

    This step not only allows you to test whether the Web service is working, it also creates the web.config file, which is necessary for debugging.

  3. On the Debug menu, click Stop Debugging.

  4. Create a client application project, either in the same solution as your XML Web service project or in a different solution.

  5. In your client project, add a Web reference and a synchronous call to the Web service.

  6. In Solution Explorer, right-click the client project, and click Set As Startup Project on the shortcut menu.

  7. On the Debug menu, click Start to run the client application.

    When your client application calls the XML Web service, the debugger will automatically step into and begin debugging the XML Web service.

For more information, see ASP.NET Debugging: System Requirements, XML Web Services in Managed Code and How to: Debug XML Web Services in Managed Code.

See Also

Other Resources

Debugging Managed Code
Debugging Preparation: C#, J#, and Visual Basic Project Types