Geeks With Blogs
Justin a.k.a. The Code Monkey Code Monkey [kohd muhng'-kee] n : 1. Creature known for it's ability to transform caffeine into code. 2. Justin Jones

Back from hiatus. 

I've never had an excuse to do remote debugging until recently, but I've always heard that it's a serious pain in the ***, hence, I avoided it.  Recently I really needed it to work, and of course, it didn't. 

Remote debugging seems to be a little easier than it used to be, and if you do enough searching you'll eventually find what you need.  Here's the short version:

Step 1: Go here: http://www.microsoft.com/downloads/details.aspx?FamilyID=440ec902-3260-4cdc-b11a-6a9070a2aaab&displaylang=en
This is the remote debugging service installer.  Assuming that you don't want a full Visual Studio installation on the remote machine, you can install this service on the remote machine.

Step 2: Add permissions.  The debugger service you downloaded in step 1 needs to run under an account that has permission to your local machine.  I think it may need admin rights on both boxes, but I'm not sure.  In any case, the accounts I used to get it to work were admins on the machines they were on.

Step 2.5: Fake it out.  Here's where it got wonky for me.  I couldn't add the permissions in step 2.  My dev box was in one domain, the box being debugged was in another domain (dev domain), and the domains did not have a trust relationship.  Therefore, I couldn't add my local account to the dev box, nor could I add the remote account to my local box.  Game over?  not quite.   There is a workaround.  Create a local account on your dev box with the same username/password as your domain account.  Do the same on the remote box.  Run the service as that account.  Magically, it all just works. 

Step 3: Miscellaneous debris.  I also was not able to resolve the remote machine's name through DNS, but when you connect to the service, it wants to resolve the name.  Get around this by adding the remote machine's name to your hosts file (at c:\windows\system32\drivers\etc\hosts).  It just works better.

Step 4: Do it.  Select Debug->Attach To Process.  Under Qualifier Type the remote machine's name (or IP address) or select Browse, if you have name resolution.  The processes from the other machine should show up.  Select the one you want.  (Don't forget to set a breakpoint). 

That's it.  Easy when you know how.  Serious pain when you don't.

Posted on Sunday, May 17, 2009 3:41 PM .Net 3.5 , Visual Studio 2008 | Back to top


Comments on this post: Remote Debugging across Domains made easy

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Thanks for posting about this!
Left by Dave on May 21, 2009 12:52 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
What about ports?
Left by BA on Jun 06, 2009 6:37 PM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Ports? Hm, I had them all open (behind the corporate firewall) so I didn't check. According to this:

http://msdn.microsoft.com/en-us/library/bb385683.aspx

it looks like you need TCP ports 135 and UDP ports 4500 and 500 open.

According to this:

http://msdn.microsoft.com/en-us/library/bt727f1t.aspx

if you're using Windows Firewall, it's preset and you can just select "Allow remote debugging".

The insanity starts here:

http://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx

(personally, I like the short version)
Left by Justin on Jun 09, 2009 6:18 PM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Thanks for posting about this!
Left by Hernia symptoms on Oct 28, 2009 8:40 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Nice article ,Remote Debugging was the single most feature which is very useful while developing larget enterprise application, specially
if your applicaiton is live and you don't have proper development environment setup in your dev box.

Thanks
Javin
How to setup remote debugging in Eclipse
Left by Javin @ tibco tutorials on Feb 27, 2011 2:18 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
I mostly use eclipse for remote debugging . its very easy to setup and its very useful for troubleshooting production issues on large enterprise application, specially if your application is live and you don't have proper development environment setup in your Dev box.
Left by JP@eclipse remote debugging on Jun 17, 2011 11:53 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Did you were able to connect to the remote debugger running VS with the DOMAIN account? If I try to run it from the DOMAIN account I get a connection error (even when the connection starts). If I start VS as the LOCAL user then everything works (but is a pain to start always VS with a different user).
Left by Ignacio Soler on Jan 31, 2012 10:02 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Even i am getting error when trying to run the debuggger remotely.

Thanks,
Java String Examples
Left by Swathi @ Techonology Forum on Jul 18, 2012 4:17 AM

# re: Remote Debugging across Domains made easy
Requesting Gravatar...
Useful information,

I got the debugging issues and troubleshooting the issue from last one week, lastly i understand the root cause after reading your blog.

Appreciate your help and hardwork.


Thanks
MessageFormat Example in java
Left by Varargs feature example in java on May 16, 2013 12:39 AM

Your comment:
 (will show your gravatar)


Copyright © Justin Jones | Powered by: GeeksWithBlogs.net | Join free