I <3 Steve McConnell*
Coding Horror
programming and human factors
by Jeff Atwood

August 12, 2004

DCOM, XP SP2, and Remote Debugging

I debug remotely at home, mostly because I prefer not using the crippleware version of IIS. It's kind of a pain to get it running, because you have to be more careful with permissons and configuration, but basically it works. At least, it worked until I installed XP SP2, anyway. There's a decent set of documentation on how to get Remote Debugging working under SP2, but I could not get it to work-- and I have the XP firewall completely disabled! Over and over, any attempt to remotely debug an ASP.NET app resulted in this exciting dialog box message:

Error while trying to run project: Unable to start debugging on the web server. Access is denied.
I ran through all the usual troubleshooting, and then some:
  • I have the same account/password on both client and server
  • the website is using NTLM authentication
  • there is an IIS application for the website
  • I am a member of the Administrators and Debugger Users group on both boxes.
  • the website loads fine if I run with CTRL+F5, eg, no debugger
  • The security event log shows me logging in just fine on the server
  • Remote Debugging support is properly installed on the server
After three hours of intense frustration, I started to feel like that Doom3 zombie-- the one mindlessly pounding his head against a bloody wall over and over. Eventually you get to that desperate point where you'll try anything, no matter how crazy. Sometimes this pays off, and sometimes it doesn't. Luckily this is one of those times where the headbanging paid off. I finally got remote debugging to work with XP SP2 by granting "Remote Access" to the ANONYMOUS LOGON account in dcomcnfg.exe on the client computer. Specifically, in
dcomcnfg.exe -> Component Services -> Computers -> My Computer -> Properties -> COM Security -> Access Permissions -> Edit Limits.
Now, the documentation does mention setting stuff in Edit Limits, but it says you have to add your account in there, and only if you're not an administrator. That doesn't even make sense; out of the box EVERYONE is granted both local and remote permissions in Edit Limits. Granting remote access to ANONYMOUS LOGON is what you have to do. Why, I have no idea, but it is totally repeatable across three computers here, including my otherwise unmodified laptop. There are plenty of people in google groups complaining about this problem, so hopefully this will help someone.

Oh, and by the way, be careful: this is also a great way to trash your machine. I strongly suggest you only grant additional permissions in dcomcnfg; do not remove any permissions. In the process of testing this-- ironically, after I finally got it working, and in order to ensure that I understood the failure conditions-- I inadvertently removed all permissions from the Edit Limits box. Friends, do not do this. Two in-place reinstalls later (one reinstall to get COM permissions back, another one to re-install the COM stuff that failed to install with the borked permissions), I had a functioning OS again. Revenge of COM...

Posted by Jeff Atwood    View blog reactions

 

« Worse Is Better Performance: Remoting vs. Web Services »

 

Comments

Hy

Thanks for this workaround!!! It works perfectly...Now, I'm waiting for an official visual studio update! :-)

FrEaK_@CH on August 17, 2004 08:15 AM

does this have any thing to do with the remote computer being Windows Server 2003? or is this the general state of things with XP SP2? It must be some case Microsoft didn't test.

Is there supposed to be a Visual Studio update?

pb on August 17, 2004 01:38 PM

Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, and thank you.

--A fellow zombie

Kevin on August 17, 2004 02:55 PM

glad to hear it helped someone!

I suspect the disabling "ANONYMOUS LOGON" to COM was done in SP2 for security reasons. Why it is not listed in the official MS document for XP SP2 remote debugging setup, I don't know.. but there is absolutely, positively no way I could get it work until I did this..

Jeff Atwood on August 17, 2004 05:16 PM

Is this safe?

will on November 18, 2004 11:07 AM

THANKS!!!!!!!!!!!!

SAME 3 HOURS OF ZOMBIENESS :((((

Too bad this article is not in top Google search for the error.

Andrew on December 5, 2004 10:35 PM

You clever chappie, well done!

Adam D on February 2, 2005 05:46 AM

I also have been playing with the DCOM security settings and managed to screw my machine by removing too many permissions. Recovered by using the dcomcnfg.exe supplied with Win2k - that version seems to restore the default permissions whereas XP's version does not! :-o

My problem is that I can't get DCOM to work across remote machines since installing SP2, firewall is totally disabled and I've tried every DCOM security setting combination that I could find on the web - I think I'm going to hire a MS uber-geek to sort it out ;-)

Rich on February 2, 2005 07:26 AM

Well...

I have the same over here. XP SP2 machines trying to debug on a W2K3 server. Have already been through everything here, but am still getting the same error! :0(

Some of my colleagues, on W2K machines, can connect to the same server without problems - so I am assuming that the problem is XP.

The server event log shows successful logon etc. So not sure what else to try. Reinstalled DTC as well (strange errors in event log), but no joy.

In VS2K3 I can manually attach a debugger to a process on the server, how is that different from the normal debug set up when F5 button is pressed!?

Am fairly sure that it is a DCOM problem, I just can't put my finger on it!

Nick on February 14, 2005 08:12 AM

> I finally got remote debugging to work with XP SP2 by granting "Remote Access" to the ANONYMOUS LOGON account in dcomcnfg.exe on the client computer. Specifically, in
dcomcnfg.exe -> Component Services -> Computers -> My Computer -> Properties -> COM Security -> Access Permissions -> Edit Limits.

Did you try that? Because that's the "magic sauce" that made it work on my XP SP2. Beyond the usual checklist in the article bullets.

Jeff Atwood on February 14, 2005 10:45 PM

Just tried this, I dont even see an edit limits.... mine looks like this:
Component Services -> Computers -> My Computer -> Properties -> Default COM Security -> Access Permissions -> Edit Default...

In here, I added Everyone, Anon login, my account...
I also tried the same in Launch Permissions.. no go. Do we need a restart?

Nick on February 18, 2005 11:16 AM

It's there. Let me clarify.

dcomcnfg.exe -> Component Services -> Computers -> My Computer -> Properties -> COM Security -> in the Access permissions box, click the Edit Limits button.

This brings up the Access Permission dialog.

Add "ANONYMOUS LOGON" to the list under "Group or user names", and make sure that user has "Local Access" checked and "Remote access" checked.

Jeff Atwood on February 18, 2005 10:09 PM

Jeff, you're a hero! I spent a man-day on this XP SP2 problem, and never would have considered dcom security.

dave romer on March 1, 2005 01:47 PM

blimey, spot on - thanks mate

Chad Smith on April 25, 2005 08:41 PM

That is awesome man!

I needed to reboot the client machine for the changes to take effect.

You just saved me days of work!

Dave A on April 26, 2005 08:36 PM

How can set Edit Limits using vbscript.
Thanks
Bogdan

Bogdan on May 3, 2005 02:55 AM

Thank you, this helped me out! I hate those badly documented "security features". Yesterday I spent the whole day trying to work around a security issue within Microsoft SharePoint, which is very hard to debug! Aargh!

Daniel on June 2, 2005 07:05 AM

Hi having same prob here but my edit limits button is grayed out!! any idea how to un gray it??

Robin on June 7, 2005 11:17 AM

Hi, Really weird one here, not remote but local. I have 2 sites that develop locally and have done since last summer. Suddenly, one of them, if you start in release it says it cant debug and if you start in debug it just ignores all debug commands. Have I flipped a switch somewhere that you know of? The other site debugs perfectly if I need to!

Dave on June 14, 2005 03:47 AM

> Hi having same prob here but my edit limits button is grayed out!!

Dunno, are you an Administrator on that PC?? It's not greyed out for me.

> Suddenly, one of them, if you start in release it says it cant debug and if you start in debug it just ignores all debug commands.

Check here:

http://blogs.msdn.com/mkpark/articles/86872.aspx

Jeff Atwood on June 14, 2005 02:21 PM

THANK YOU.

Link this folks. It works. Get it up there on search results.

Jim C on June 15, 2005 11:24 AM

Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, and thank you.

--A UK zombie thats was THIS close to doing something that would have got him fired

David C on July 13, 2005 09:15 AM

GOD!! THANXX! Thanx alot. Now i can go eat and sleep and many other things after 6 hour $%^ing.
Thank you SO much!

Solo on July 22, 2005 03:47 PM

Good god, it worked :)

Geebus what a pain in the rear that was, like you I was getting dizzy and ready to use a blunt object to end the frustration. It works, wooo fooking hoo.

Jason Clark on July 29, 2005 07:56 PM

I love community. That was a huge help! Thanks.

Travis on August 9, 2005 09:47 AM

This did it for me. I only wasted about half a day trying to get this work. Argh!!!! Thanks!

After I saw this I searched again and found this article on MSDN:

http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;833977

Jim on September 12, 2005 04:48 PM

I can't believe that this was the problem all along. I wasted about 2 days surfing the net, trying out just about everything. I was beginning to think my 2k3 server box was screwed up and was about to reinstall windows. Little did I know this was a client side problem.
Thanks for posting this fix.

rjt on September 14, 2005 08:49 PM

Thank you SO much. I wish this information had come up on Google ranked Number 1.

Brilliant Headbanging exercise. Thanks a lot!!

S

Reynos on September 29, 2005 01:04 PM

Just got over a simmilar problem with Visual Studio ourself. Regardless of what type of program we were trying to debug we were getting the wonderful "Access is Denied" error. We tried everything on Microsofts site to fix it with no luck. We then moved on to combing the web for help and had no luck with sites we found there, however the info on this page was the closest to the eventual solution. In the end we had to bite the bullet and pay Microsoft 250 bucks to help us and while it now works I think the stuff they told us should be freely available on their site as it was all caused by their service packs and their extra "security".


PROBLEM DESCRIPTION:
---------------------------
Microsoft Development Environment
---------------------------
Error while trying to run project: Unable to start debugging.
Access is denied. Verify that you are an administrator or a member of the 'Debugger Users' group on the machine you are trying to debug. After being added to the 'Debugger Users' group, you must log off and log back on for the setting to apply.
---------------------------
OK
---------------------------

CAUSE:
Permissions were not enough

RESOLUTION:
We made the following changes in DCOM:

Go into dcomcnfg (Select Start -> Select Run -> Type dcomcnfg -> Select OK) and set
the following up:

1. On the Default Properties Tab
a. Make sure that Enable Distributed COM on this computer is checked
b. Set default authorization level to Connect
c. Set default impersonation level to Identify

2. On the Default Security Tab
a. Edit Default for the Default Access Permissions
b. Add the following accounts if they are not present
1. MachineName\Administrators
2. MachineName\Debugger Users
3. System
4. Interactive
c. Edit Default for the Default Launch Permissions
d. Add the following accounts if they are not present
1. MachineName\Administrators
2. MachineName\Debugger Users
3. System
4. Interactive
5. IWAM_MachineName
3. On the Applications Tab, locate and select the Machine Debug Manager
application
a. On the General Tab, make sure that the Authentication level is set to
connect
b. On the Security Tab, select Use Custom access permissions and sleet the Edit
button
c. Add the following accounts if they are not present
1. MachineName\Administrators
2. MachineName\Debugger Users
3. System
4. Interactive
d. On the Security Tab, select Use Custom launch permissions and sleet the Edit
button
e. Add the following accounts if they are not present
1. MachineName\Administrators
2. MachineName\ Debugger Users
3. System
4. Interactive
f. On the Identity Tab, make sure that The System Account (services only) is
selected
g. Click OK until you are back to the Distributed COM Configuration Properties
dialog.
h. Click OK and restart your machine.

4. Changed into c:\program files\common files\microsoft shared\vs7debug.
Ran mdm .exe /unregserver and mdm.exe /regserver

We must reboot the machine

Me on October 17, 2005 11:02 AM

To Me - thanks heaps - spent a couple of days tracking this down - I think it was the sly-dog windows automatic updates which broke my debugger in the first place (it was working one day and not the next). Serves me right for letting MS put stuff on my PC when I'm not looking.

JJ on January 26, 2006 07:01 AM

Marry me!

GoneMad on May 30, 2006 12:23 AM

I experinced the same problem after installing xp xp2. Searched every where in net. no luck. finally saw your siet before formatting it. .. and it worked. Thanks you very much.

Sumesh on June 26, 2006 01:38 PM

Jeff, you're a legend for posting your solution so that Me could post their solution to the same entry because that's exactly the same problem I was having and his/her solution fixed it outright. My PC was clsoe to being hurled out of the window and into the 50 metre deep quarry only yards from said window, which would probably have earned me one freshly minted P45 until I found this solution.

Code Monkey on July 18, 2006 06:29 AM

To Me,

All other sequences I found on the net just didn't work. However, I am glad I read all the posts below this article ... worked like a peach.

Thank you for posting the solution.

Lee on July 18, 2006 01:05 PM

Thank you. After 8 hours of searching I found your posting... your solution worked.

XP SP2 by granting "Remote Access" to the ANONYMOUS LOGON account in dcomcnfg.exe on the client computer

Well done my friend.


Bill on August 16, 2006 06:07 PM

I bow to you, sir. You are my hero.

Carlos on October 3, 2006 07:06 PM

Every time I get a new PC at work, we have this problem. Every time, I forget how to fix it. Thankfully, I had this site linked in an email from the last time it happened.

Thanks (again). And WHY IN HELL is this not on any Microsoft page??????

Jim C on October 4, 2006 12:19 PM

I've been on this problem for a week now... never mind 3 hours! I gave it a try, but no go. Obviously I've done something seriously wrong, maybe deployment... of course, Microborg doesn't tell you jack about how to deploy so debugging is easier, do they???

And nobody on their forums ever addresses problems like this. They just treat people like lepers. ARGH!

P B on January 9, 2007 02:30 PM

You my friend have just become my newest hero! I spent the last 2 weeks trying to figure out why the PC was refusing DCOM connections after a SP2 upgrade. Applied your fix and like magic it all started working. I just wish I had seen your post 2 weeks ago!

Kudos!
Robert

Robert Fuoco on February 1, 2007 11:11 AM

Hi Guys,

The previous fix worked and allowed dcom connection again, however now I have another strange issue that I am wondering if anyone can help out with.

Dcom connection seems to run fine on the server for about a week. After a week the server machine stops accepting DCOM connections and I get the same error I did before the fix. Rebooting the server machine allows DCOM to start accepting connections again. Unfortunately I cannot reboot a production server every week so I am wondering if anyone has any suggestions?

Calling all DCOM experts.

Thanks
Robert

Robert on April 18, 2007 11:32 AM

The Fix to my last problem if anyone is having the same issue was to unintiall HIPS (Mcafee Host Intrusion Prevention Software). Unexplainable I know, but after removing it DCOM has been accepting connections for 2 weeks now without faillure.

Hope this helps someone else.

Robert on May 11, 2007 10:53 AM

You are a living legend! I've been round this loop before and have sorted by other means but I've never had SP2 before.

Thank you kind sir, you have seriously relieved me of major stress - I was about to throw my laptop out of the window!

Max

Max Parmenter on July 20, 2007 01:06 PM

Do I need to install DCOM in my XP and Window Vista Machine?

Ashish on October 17, 2007 06:38 AM

Actually I want to connect to Vista machine through XP.
bcoz DotNet is installed in My XP machine and I want to debug my application on Vista machine through Xp.Is it possible?
Which s/w, I have to install in both machine?
Pls help me, I already spent 2 Man days.
Thanks in advance...

Ashish on October 17, 2007 06:45 AM

Remote Debugging support is properly installed on the server

küresel ısınmaya hayır on November 23, 2007 09:39 AM

Thanks ,this was very usefull

Rajeshwart on April 30, 2008 03:37 AM

If the edit limits button is disabled (grayed out), try editing the local security settings.

Local Security Settings
-> Security Options
-> DCOM: Machine Launch Restrictions

and add a user, it will cause the corresponding button in Component Services to be greyed out.

RESOLUTION:
Delete the users in the security policy (ie. Remove all users and click
Apply and OK.) It will appear as NULL in the security policy, but once
refreshed, it will then show "Not Defined".
Go back to Component Services and you'll notice that it's reset back to the
original.

(thanks Remco)

Jaime on April 30, 2008 09:38 AM







(hear it spoken)


(no HTML)




Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.