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