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
posts - 10 , comments - 26 , trackbacks - 0

Remote Debugging across Domains made easy

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.

Print | posted on Sunday, May 17, 2009 3:41 PM | Filed Under [ .Net 3.5 Visual Studio 2008 ]

Feedback

Gravatar

# re: Remote Debugging across Domains made easy

Thanks for posting about this!
5/21/2009 12:52 AM | Dave
Gravatar

# re: Remote Debugging across Domains made easy

What about ports?
6/6/2009 6:37 PM | BA
Gravatar

# re: Remote Debugging across Domains made easy

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)
6/9/2009 6:18 PM | Justin
Gravatar

# re: Remote Debugging across Domains made easy

Thanks for posting about this!
10/28/2009 8:40 AM | Hernia symptoms
Gravatar

# re: Remote Debugging across Domains made easy

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
2/27/2011 2:18 AM | Javin @ tibco tutorials
Gravatar

# re: Remote Debugging across Domains made easy

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.
6/17/2011 11:53 AM | JP@eclipse remote debugging
Gravatar

# re: Remote Debugging across Domains made easy

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).
1/31/2012 10:02 AM | Ignacio Soler
Gravatar

# re: Remote Debugging across Domains made easy

Even i am getting error when trying to run the debuggger remotely.

Thanks,
Java String Examples
7/18/2012 4:17 AM | Swathi @ Techonology Forum
Gravatar

# re: Remote Debugging across Domains made easy

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
5/16/2013 12:39 AM | Varargs feature example in java
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 
 

Powered by: