Chapter 10. Tracing and Debugging

Introduction

The recipes in this chapter show you how you can locate problems in your ASP.NET applications by using features that support tracing, debugging, and stress testing.

The first six recipes show you how to use tracing to pinpoint the causes of problems in your code. Tracing allows you, through a simple configuration setting or page-level attribute, to have ASP.NET write a whole host of information about the currently executing request to the page or to a trace log. We start by discussing how you initiate page- and application-level tracing. We also show how you can dynamically turn on page-level tracing when an exception occurs. Next, we show you how to make tracing work for components—those that will run on the web, as well as those that will be used elsewhere. The latter technique is important when you don’t want your use of tracing-related code to preclude you from using a component outside of ASP.NET. We also show you how to write trace information to a log file from within a component.

Next we discuss debugging, specifically how setting conditional breakpoints can be a powerful technique for debugging your ASP.NET applications. Setting conditional breakpoints is especially useful for stopping execution at a specific point in iteration-heavy code, the focus of one of this chapter’s recipes.

Finally, we take a look at stress testing, using the Application Center Test (ACT) tool, which is available to users of the Enterprise Architect and ...

Get ASP.NET Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.