Udostępnij za pośrednictwem


How to: Debug Web Services in Managed Code

 Windows Communication Foundation Services and ADO.NET Data Services

When you are ready to build and run your Web service, you must first compile the ASP.NET Web Service project. Once compiled, you can run the Web service. For more information, see Debugging Preparation: ASP.NET Web Service Projects.

You can choose from three methods to build and run your Web service:

Method

Description

With the debugger

This method starts the default browser and loads the specified start page. Running a page in the debugger makes it possible for you to step through code line-by-line and use additional analysis tools and runtime information. If Visual Studio detects that key files have changed, it will also build the project before launching the browser with the specified start page.

Without the debugger

This method makes it possible for you to run your code as it normally would run outside of the context of development tools, and therefore no runtime information is available through these tools. If Visual Studio detects that key files have changed, it will build the project before launching the browser with the specified start page. However, you can attach the debugger to the process as needed.

View in browser

This method compiles the project and opens a Web page chosen from Solution Explorer. Visual Studio compiles and runs the project in the default browser within Visual Studio.

To build and run a Web service with the debugger

  1. In Solution Explorer, right-click the .asmx file for the Web service you wish to run and click Set As Start Page on the shortcut menu.

  2. On the Debug menu, click Start.

    This command instructs Visual Studio to run the Web service in the debugger.

  3. To stop running the form and return to the Code Editor, close the browser, or click Stop Debugging on the Debug menu.

To build and run a Web service without the debugger

  1. In Solution Explorer, right-click the .asmx file for the Web service you wish to run and click Set As Start Page on the shortcut menu.

  2. On the Debug menu, click Start Without Debugging.

    Visual Studio saves all files in the project and then builds it. Once built, Visual Studio launches the default browser and navigates to the project's start page.

  3. To stop running the Web service and return to the Code Editor, close the browser.

To build and run a Web service using the View in Browser option

  1. In Solution Explorer, right-click the .asmx file for the Web service you want to run and click View in Browser on the shortcut menu.

    Visual Studio builds the Web service and launches the specified start page within the IDE.

  2. To stop running the Web service and return to the Code Editor, close the browser.

See Also

Tasks

Debugging Preparation: XML Web Service Projects

Other Resources

Creating Web Services in Managed Code