Debugging ASP.NET Applications in IIS

ASP.NET applications can be debugged using the features of the .NET Framework. For more information about debugging .NET applications, see Debugging and Profiling Applications and Creating ASP.NET Web Applications.

Common Pitfalls

Some common problems when developing ASP.NET applications are as follows:

  • Not including references to namespaces when calling methods contained in the namespaces. Namespaces are included with the using keyword in C# code and the imports keyword in Visual Basic? (VB).

  • In addition, a reference must be added to a project when using Visual Studio.NET, and the dll containing the namespace must be referenced (/reference:DLL_name or /r:DLL_name, a reference must be added to a project when using Visual Studio.NET, and the dll containing the namespace must be referenced (/reference:DLL_name or /r:DLL_name, DLL_name_2) in the command line when using a command-line compiler.

Debugging Features

ASP.NET contains features that enable sophisticated debugging: tracing and instrumenting.

Tracing is a way for you to monitor the execution of your application while it is running. You can add tracing and debugging instrumentation to your .NET application when you develop it, and you can use that instrumentation both while you are developing the application and after you have deployed it. With the Trace and Debug classes, you can record information about errors and application execution to logs, text files, or other devices for later analysis.

Instrumenting your application by placing trace statements at strategic locations in your code is especially useful for distributed applications. With trace statements you can instrument an application not only to display information when things go wrong - you can also display information to monitor how well the application is performing. See the topics ASP.NET Trace and Tracing and Instrumenting Applications in Visual Basic and Visual C#.