The default ASP.NET web server that launches from within Visual Studio (Casini) is a little buggy on my development machine, so I like to publish to a local IIS instance on my dev machine and look at the web application there. However, I’m not automatically in “Debug Mode” when I launch the application this way.
I know that VS 2010 has an “Attach to Process” debug feature, but I’m not sure exactly how to use it. What do I need to do to be able to debug a local IIS ASP.NET web application from within Visual Studio? Specifically:
- What settings do I need to change in the configuration of my web application?
- What “Package/Publish Settings” do I need to change?
- Is there anything I need to change in IIS?
- Is there anything special I need to do in the “Attach to Process” screen?
Background Information: I’m running Visual Studio 2010 on Windows XP SP3 with IIS 5.1 and .NET 4.0.
Additional Information:
I should add that I’ve tried attaching to aspnet_wp.exe, but when I go to a page that I know has a breakpoint in it, I get the following message when I hover over the “open circle” breakpoint:
The breakpoint will not currently be hit. No symbols have been loaded for this document.
I wasn’t ever to get it work using F5 in Visual Studio, even when it was set up to deploy to the local IIS server. I’m not sure what exactly the problem was, but I eventually was able to get it to work in a much more “manual” fashion. A big part of getting this to work is to make sure you are generating debug symbols and deploying them to your web site. Here are the steps I took to eventually get it work:
IIS Web Site Name/Virtual DirectoryAfter you’ve done the above, you should be ready to deploy your application so that it can be debugged. Here are the steps I use to deploy and subsequently debug the application:
While this method works great, keep in mind that it’s not just attached to your local development environment. If another user on a different computer were to access the web application, I believe the breakpoints will still fire as long as your are debugging the process.