Solution 1:

In Visual Studio:

  1. Click "Debug" from the menu bar
  2. Click "Attach to Process"
  3. Check the "Show processes from all users" checkbox in the bottom left corner
  4. Select aspnet_wp.exe, w3p.exe, or w3wp.exe from the process list
  5. Click "Attach"

Solution 2:

Just to clarify Jimmie R. Houts answer…

If you want to debug the web application VS and IIS you can do the following:

  1. Host the site inside IIS (virtual directory etc).
  2. Then in VS2005 do this:

    • Right Click on Web Project → Properties → Start options → Use Custom Server → Base URL → Enter Site Address as Hosted in IIS.
    • Hit F5 and you will be able to Debug your code

Same works for VS 2008 also.

Solution 3:

I'm running Windows 7 with IIS Version 7.5 and I also needed to tick the "Show processes from all users" and "Show processes in all sessions" boxes - at the bottom of the "Attach to Process" dialog.

Also I had put my app in a specific App Pool which means you can then see it labeled against the w3wp.exe.

Solution 4:

The IIS process is aspnet_wp.exe.

In fact, attaching to the aspnet_wp.exe process is what VS does when you have your project set to use IIS for debugging.