Export (0) Print
Expand All

Debugging Preparation: ASP.NET Web Service Projects

The ASP.NET Web Service project template creates the default project settings for debugging. For more information, see Creating ASP.NET Web Service Projects. When you choose Start from the Debug menu, these 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.

Enabling ASP.NET Debugging

If you need to debug a client application's call to the XML Web service, you must enable ASP.NET debugging in your client application.

To enable ASP.NET debugging in a C# application

  1. In Solution Explorer, select the C# project.
  2. From the View menu, choose Property Pages.
  3. In the <Project> Property Pages dialog box, in the Configuration list box, choose Debug.
  4. Open the Configuration Properties folder and select the Debugging category.
  5. In the properties grid, under the Debuggers heading, set Enable ASP.NET Debugging to True.

To enable ASP.NET debugging in a Visual Basic application

  1. In Solution Explorer, select the Visual Basic project.
  2. From the View menu, choose Property Pages.
  3. In the <Project> Property Pages dialog box, in the Configuration list box, choose Debug.
  4. In the Configuration Properties folder, choose the Debugging category.
  5. Under the Debuggers heading, select ASP.NET debugging.

When you start debugging your client application, the debugger attaches to your client application and the ASP.NET worker process (aspnet_wp.exe under Windows 2000 and Windows XP or w3wp.exe under Windows Server 2003). Then, when the client application makes a call into the XML Web service, the debugger tracks the SOAP call and follows the call stack chain to the XML Web service process.

For more information, see XML Web Services in Managed Code and Debugging XML Web Services in Managed Code.

Changing Default Configurations

If you need to change the default Debug and Release configurations created by Visual Studio, you can do so. For more information, see Debug and Release Configurations.

To change the default Debug configuration

  • Define the DEBUG and TRACE constants, which allow your application to use the Debug and Trace classes.
  • Turn on Generate Debugging Information.
  • In Visual C#, set the Output Path to bin\Debug\. In Visual Basic, set the Output Path to bin\.
  • In Visual C#, set Optimize code to false. (Optimized code is harder to debug, since the generated instructions do not correspond directly to your source code. If you find your program has a bug that appears only in optimized code, you can turn this setting on, but remember that code shown in the Disassembly window is generated from optimized source that may not match what you see in your source windows. Other features, such as stepping, may not behave as expected.)
  • Set the Enable ASP.NET debugging property to True.

For details, see Project Settings for a C# Debug Configuration or Project Settings for a Visual Basic Debug Configuration.

See Also

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

Show:
© 2014 Microsoft