How to: Debug while Running a Test in an ASP.NET Solution
Mar 20, 2006vstsuetb

Summary
This post details how to debug ASP.NET production code while a test is running. It explains that test code runs in either the IIS process or the ASP.NET Development Server process, not the typical VSTestHost process. It provides step-by-step procedures for attaching the debugger to IIS (w3wp.exe or aspnet_wp.exe) by enabling debugging in Web.config and attaching to the process, and for debugging with the ASP.NET Development Server by adding `System.Diagnostics.Debugger.Break()` to the test and then attaching to the process when the breakpoint is hit. It also clarifies the difference between 'Debug Selection' and 'Run Selection' for tests.