Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote debugging managed applications

How do I remote debug a managed application from other machine which has visual studio. This is what I have tried:

  1. Copy the remote debug folder which comes part of visual studio into remote machine and run msvsmon.exe (64 bit version as both machines are 64 bit).
  2. Use the same windows login account in both machines.
  3. Then I start visual studio and use attach to process. In the transport I select "Default" and in qualifier I give the hostname of the machine where msvsmon.exe is running.
  4. Then I press Refresh button to see the list of processes on that machine. I can see that on the other it says "User xyz is connected". However, the refresh fails and I get following error : Error screen

What am I doing wrong here? I am trying with VS2008 Pro and OS on both systems is Windows Server 2008 R2 if it matters.

Note: I can debug unmanaged applications using Remote transport without any issues.

like image 732
Asha Avatar asked Aug 02 '13 10:08

Asha


3 Answers

Even though your machines are 64 bit, make sure the applications you are running are 64 bit. For example if you are debugging a 32 bit application on the remote machine, you would want to run the 32 bit version of msvsmon.exe

This may not be the answer, but something to check to make sure of.

Update in 2017

As I've been using remote debugging more over the past few years, I've noticed a few more issues that I usually have to work through.

  1. Make sure the same version of msvsmon is being used on each machine.
  2. Make sure authentication is correctly configured (try and get no authentication to work first, then turn it on later if you need it)
  3. Make sure when you attach to process, you have the correct "Attach To" settings (i.e. Managed .NET version, Native code, etc.)
  4. Make sure the msvsmon is running as Admin OR as the same user identity as the application you want to debug
like image 140
C. Tewalt Avatar answered Oct 20 '22 00:10

C. Tewalt


I also lost a lot of hours on this. The only way I've found to make it works 100%, is to use the same domain. With VS2012 it's easier to connect without being in the same domain.

But for 2008, this is working for me (A = VS side, B = machine without VS)

1) The machine A (where VS is) and B must be in the same domain. You also need to download and install VS Remote Debugger monitor on B

2) You need to start VS Remote debugger monitor on the B side, to allow incoming connection. When you start it the 1st time, it'll configure the firewall to open the ports. It also show you on which address it's listening, i.e. DOMAIN\User@hostname_B

3) Run VS with a domain admin account on A, and you'll be able to remotely debug. To connect to B in debug, use the address shown in step 2 by the monitor

Hope it'll help you !

like image 34
Fabske Avatar answered Oct 20 '22 01:10

Fabske


Starting with Visual Studio 2012 you can use the Remote (no authentication) transport to debug managed code (previously VS only allowed to debug native code in Remote mode).

like image 27
Motti Avatar answered Oct 20 '22 01:10

Motti