Debug .NET Apps ... Without VS .NET

Use DbgCLR.exe to root out bugs in your Web services and ASP.NET apps.

Jeff Prosise

October 30, 2009

2 Min Read
ITPro Today logo

Hot Tip

LANGUAGES: All.NET languages

ASP.NETVERSIONS: 1.0 | 1.1

 

Debug .NET Apps ... Without VS .NET

Use DbgCLR.exe to root out bugs in your Web services andASP.NET apps.

 

By Jeff Prosise

 

Everyone knows you can debug ASP.NET projects built withVisual Studio .NET using VS .NET's fabulous integrated debugger. But did youknow you also can use a full featured debugger to debug ASP.NET apps and Webservices built using something other than VS .NET? It's named DbgCLR.exe and itcomes with the .NET Framework SDK. It's great for debugging .aspx and .asmxfiles that contain embedded code (as opposed to files that use code behind).Here's how you can put DbgCLR to work using breakpoints to debug an .aspx file.

 

First enable debugging in the page you want to debug. Youcan enable debugging for a particular page by adding a Debug="true"attribute to the @ Page directive at the top of the page, or you can enabledebugging for the entire application by adding a element to web.config. Next, open the page you wishto debug in your browser and start DbgCLR (you can find it in the ProgramFilesMicrosoft Visual Studio .NETFrameworkSDKGuiDebug directory). Now selectthe Debug Processes command from DbgCLR's Tools menu. Select the ASP.NET workerprocess in the ensuing dialog (the process name is either aspnet_wp.exe orw3wp.exe, depending on which version of IIS you're running), click on theAttach button, and then click on Close. Next, use DbgCLR's File/Open command toopen the .aspx file you intend to debug and set your breakpoints. Finally,return to your browser and do something to cause a breakpoint to be hit. Oncethe breakpoint is reached, DbgCLR moves to the foreground and highlights thestatement where execution was halted. Press F10 to single-step your way throughthe code, or you can use DbgCLR's myriad other debugging features to analyzethe offending code.

 

Now that you know about DbgCLR, you can run any ASP.NETapp in a debugger regardless of whether the app was developed with VisualStudio .NET.

 

Jeff Prosise isauthor of several books, including ProgrammingMicrosoft .NET (Microsoft Press). He also is a co-founder of Wintellect(http://www.wintellect.com),a software consulting and education firm that specializes in .NET. Contact Jeffat [email protected].

 

 

 

 

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like