Attach Two Visual Studio Debuggers to IIS at the Same Time

1 Comment

Occasionally you need to be able to run two instances of Visual Studio to debug two different web applications simultaneously. If these web applications are set up to run in IIS, you may get the following error when you try to attached the second debugger:

Unable to start debugging on the web server. A debugger is already attached.

To run your applications, IIS creates a worker processes for each “Application Pool” you define in the IIS configuration. It then runs all applications assigned to a given App Pool in the same process. Since only one VS debugger can be attached to any given process at a time, simply putting your web apps in different App Pools is all it takes to get this scenario working.

Here are the steps:

  1. Open the Internet Information Services (IIS) Manager
  2. Select Application Pools in the tree view on the left
  3. Click Add Application Pool… on the right pane
  4. Give it a name (usually the application/site name)
  5. Assign the same settings as the original App Pool and click OK.
  6. Highlight the site in the left tree view that you want to move to the new App Pool.
  7. In the right pane, chose Basic Settings…
  8. Select your new app pool in the drop down list and click OK.
  9. Select the sever node in the tree view and then Restart from the right pane.