Friday, June 17, 2011

Visual Studio : Debgging ASP.NET appaliocation running in IIS

VS 2010 - IIS 7.5.

Normal situation for me is to run my applications inside IIS rather than inside the VS web server or IIS Express. This is mainly because of issues around https (although IIS Express does help in this regard).

The problem then is how to debug it. The way around this is to use Debug / Attach to Process.

First connect to your application from a browser.

Now go to VS, set your breakpoint and in the "Attach to Process" entry, you'll see a w3wp.exe entry. (Under the user name , you'll see that it uses the DefaultAppPool.) Click on this, ignore warnings and execute your application workflow from the browser until you hit the breakpoint.

Job done!

Note: Nearly all of my applications use the DefaultAppPool. Would it breakpoint if it used a different one?

Note: I've found that unless you run up your app in the browser first, you don't see the w3wp entry.

Enjoy!

No comments: