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 thoughts on “Unable to attach to the process. A debugger is already attached. – Unable to attach to IIS problem in Visual Studio.

  1. 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

    1. 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

  2. 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

  3. 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.

  4. 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

  5. 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.. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *