Some of the errors that I saw while trying to debug managed(.net) code remotely...
- Logon failure: unknown username or bad password
- A firewall may be preventing communication via dcom to the local computer
- The visual studio remote debugger on the target computer cannot connect back to this computer. Authentication failed.
... and many more.
There was no problem with native code remote debugging.
Here is the setup I had to do to make it work. Tried this with VS2010 to debug a .net 4.0 application. This should also work for other VS IDEs and .net frameworks.
- Firstly, both the machines should be logged in using
the same username(local user) and password. The user has to be an
administrator. For example, I created a new local user on both the
machines named "madscientist" and added it to the administrators group.
- Now, Im not sure for which user the following security setting had to be done (local or remote).. i did it for both of them...
- Open Control panel > Administrative Tools > Local Security Policy
- Local security settings window > Security settings > Local policies > User rights assignments >
- Double Click on "Logon as service", listed on the right side and add the user here.
- Next, Local security settings window > Security settings > Local policies > Security options
- Double Click "Network access: Sharing and security model for local accounts", select "Classic: Local users authenticate as themselves."
- In case you are not able to connect machines to each other using hostnames... Edit the C:\WINDOWS\system32\drivers\etc\hosts file on both the machines. Add the name and ipaddress the other machine.
- Restart both the machines... everything in windows(and in life) works fine after a restart.
- Run the remote debugger on the machine where you have the process to be debugged. Make sure you have your debug dlls there.
- On the local machine open the attach to process window and in the qualifier text enter "username@remotehostname" (ex:madscientist@machinename). Trasnport, default.
This should list all the processes.
Some more things you have to take care is that...
- Make sure the two machines are connected to each other :)
- Take care of the firewall... if any warnings appear w.r.t visual studio or the debugger... grant access.
- You can debug
- .net 4.0 using VS2010
- .net 3.0 using VS2008 or later,
- .net 2.0 using VS2005 or later,
- .net 1.1 using VS2003 or later