Export (0) Print
Expand All

Debugging Preparation: ASP.NET Web Applications

The Web Application project template creates a Web form. For more information, see Web Forms Pages. When you create a Web Application project, Visual Studio creates the default project settings for debugging. 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 attach the debugger to the browser and the ASP.NET worker process (aspnet_wp.exe under Windows 2000 and Windows XP or w3wp.exe under Windows Server 2003).

To debug your Web form

  1. Set one or more breakpoints in your functions and event handlers. For more information, see Breakpoints.
  2. When a breakpoint is hit, step through code inside the function, observing execution of your code until you isolate the problem. For more information, see Stepping.

For more information, see Debugging Script and Web Applications.

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