Unable to attach to the process. A debugger is already attached. – Unable to attach to IIS problem in Visual Studio.

So I came across this sweet little problem that I wasn’t able to attach to IIS 7.5 from my VS 2012 on Windows 7 and I want to share the solution with you.

I am taking part on development of larger ASP.NET WebForms 4.5 application and we are using local SQL server + local IIS 7.5 on Windows 7. From some point in time, I wasn’t able to attach to IIS w3wp.exe process.  Every other process I was able to attach however and I was puzzled. The note I had from VS 2012 was looking like this :unable to attach to the process IIS vs 2012

The problem was, that I wasn’t for some time creating any server side code (I was playing on the client) and I installed some tools and programs that might changed something. Another problem was, that I could inspect the w3wp.exe in say Process Explorer but I wasn’t able to find any tool that would tell me : what process in attached to some particular process of my interest (if you know any tool that can do this, please share, thank you). I googled and binged but most of the problems I found were about Developer Tools in IE attached to IE itself and nothing that could help me.

Today I had some time to fiddle around and the solution is simple :

I was playing with this tool from Microsoft : Debug Diagnostic Tool 1.2 which is able  (if you create a rule for that) to listen to IIS and collect exceptions. I created a rule some time ago and I forgot to deactivate it. So everytime IIS started, it attached and collected the data. I told DDT to do so. And I was second in a row. If you deactivate the running/attached rule, VS will be able to attach again.

Just don’t forget to do so.

debug diagnostic tool deactivate rule

Hope this will save you some time. 🙂 Enjoy.

18 comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. Pingback: Unable to attach to the process. A debugger is already attached. problémik s IIS - roštáčik
  2. nehasingh · May 15, 2013

    If your machine is a 64 bit machine run the following command prompt:–

    regsvr32.exe “%ProgramFiles(x86)%Common FilesMicrosoft SharedVS7Debugmsdbg2.dll

    else if your wingow is a 32bit window run :–
    regsvr32.exe “C:Program FilesCommon Filesmicrosoft sharedVS7Debugmsdbg2.dll”

    ** note open commond prompt as an admin

    • dusan · May 15, 2013

      hello sir.
      thank you for the response. this goes for what VS version? also 2012 (I have 2012 and found the DLL, just to be sure)

      regards,
      dušan

  3. Martin · May 15, 2013

    I successfully add it, but it does not work.

    C:Program Files (x86)Common Filesmicrosoft sharedVS7DEBUG>regsvr32.exe msdbg2.dll

    Martin

  4. Aram · May 15, 2013

    this really helped, i had the exact same problem,
    i’ll share the same solution on my own blog with the link to your post..

    Thanks
    Aram

  5. Boris Modylevsky · May 15, 2013

    Thanks for your post. It helped me either!

  6. Mark O · May 15, 2013

    Thanks for reminding me that I had left this on. I would have probably wandered through the desert even longer had it not been for this.

    • dusan · May 15, 2013

      glad it helped someone 😉 enjoy

  7. Tihomir Iliev · May 15, 2013

    Just played with this Debug tool and this happened. Thanks a lot.

    • dusan · May 15, 2013

      my pleasure sir 🙂

  8. prashanth · May 15, 2013

    Thanks a lot…

  9. Swen Johnson · May 15, 2013

    Thanks for posting. This was exactly my problem; you’ve saved me days of googling.

  10. Steven Sproat · May 15, 2013

    Thanks very much for this – I had the exact same problem, and the same cause! I had enabled the Debug Diagnostics tool a week or so ago and totally forgot about it

  11. Dheeraj · May 15, 2013

    Thanks it helped me!! Really appreciate

    • dusan · May 15, 2013

      with pleasure sir 🙂

  12. DEV · May 15, 2013

    Thanks Sir, its awesome, it helped me..i had played with debugdiag, but didn’t in my senses I thought it would attach w3p process and block my debugging..this saved my precious time,thanks.. 🙂