.NET remote debugging as another user from another domain?
Asked Answered
D

8

13

I am trying to debug remotely via Visual Studio 2010. But I am unable to tell the debugger to use another (remote) account on the remote machine. (Not to use my account.)

Any hints?

UPDATE: I don't have the remote account on my computer (it is in another domain). So I cannot use runas.

Dialecticism answered 26/10, 2011 at 15:34 Comment(5)
does right click run as not work?Hip
Have you considering running VS 2010 via runas as the other user?Bab
Just checking - Did you configured permissions on remote computer correctly in debug monitor ( msdn.microsoft.com/en-us/library/ms164722.aspx )... I was going to answer with "use non-authenticated, but it only works for native code).Spraggins
Yes, permissions are ok.Dialecticism
What error do you actually get? Have you tried using the correct version of msvcmon and allowing access to your account? (If you're on a different domain, I assume you tried the fully qualified account name by doing DOMAIN\username.Normy
M
2

Been fighting with this for a long time.

Check that

  1. Both computers are in the same domain OR both VS remote debugger and client VS are running as a same user with identical password. Your users can be in different domains or workgroups but login name must be identical
  2. Unrestricted direct connection between machines in both direction is required.
Monolingual answered 26/10, 2011 at 15:48 Comment(4)
Ad 1: My question is whether it is possible to user another user from another domain? (Maybe using some not well documented workaround.)Dialecticism
This is not required. Just create usernames on both machines which are spelled identically.Monolingual
This would require to change local password or lower password policy on remote server. But maybe there is a way to use another user...Dialecticism
unfortunately I couldn't find another way to do this :( You could ask to create a debugger user remotely if this is a (pre)production server and even then if remote server can't connect back to your VS machine you're doomed. The only workable solution is extensive logging and proper utilization of log levels without slowing down production code.Monolingual
B
2

In my experience remote debug is a pain to set up! Here's how I do it (similar to replies you've already had):

  1. On the remote box, create a local admin user with the same username and password as your domain account. Make sure this local user is part of the debugging group.
  2. On your local box, share the remote debug folder in VS (...\common7\ide\remote debugger)
  3. On the remote box, create a shortcut to the msvsmon.exe file in the share created on your local box.
  4. On the remote box, run the shortcut so remote debugger starts. This guarantees you are running the correct remote debug version.
  5. From visual studio try connecting to the remote machine with User@machine_name, where User is the username of the logged in user on the remote box (not the local admin account you created).
  6. You should see the remote debugger register the connection.

If this doesn't work you may have further networking or permissions problems.

Hope that helps!

Bernardabernardi answered 9/5, 2012 at 22:31 Comment(0)
P
2

I've debugged process on remote computer across domain as another user several times.

First, you need to learn how to debug remote process in the same domain. @KyleMit's answers completely helped me do that.

But, for across domain debugging also you need to edit C:\Windows\System32\drivers\etc\hosts file on local computer.

Just add remote computer's ip address like this:

172.172.172.172     SRV-TEST-ADRESS

Where:

  • 172.172.172.172 - ip address of your remote server
  • SRV-TEST-ADRESS - Server's name from Visual Studio Remote Debugger Monitor on remote computer

You can know your server's ip address by ipconfig in cmd

Visual Studio Remote Debugger Monitor

If you need more details explanation about across domain debugging, check this link.

Pteranodon answered 16/12, 2015 at 11:4 Comment(0)
U
0

Here's a shot in the dark... with the big assumption you have VPN access. And I'm still not sure it would work. Maybe worth a try though

  1. Connect VPN
  2. Add the domain account as a local user on your remote box
  3. See if you can right click run as that account.
Unanswerable answered 26/10, 2011 at 16:4 Comment(0)
A
0

After running remote debugger monitor on remote machine, configure debugging permissions to allow access for everyone. When you connect to the remote machine from your Visual Studio use this format for Qualifier:

remote_domain\remote_user@remote_machine

Remote user is the one under which remote debugger runs. Remember about firewall on the remote machine.

Adipocere answered 15/2, 2012 at 11:46 Comment(0)
C
0

I've seen it work when you have local accounts on both sides, spelled identically and with the same password. Not consistently enough that I'd rely on it.

Have you tried using windbg instead? It's a bit painful to use at first, but it gets the job done.

Countersign answered 22/5, 2012 at 4:24 Comment(2)
I am debugging .NET application. (I think windbg does not support that.)Dialecticism
It does support .net! See msdn.microsoft.com/en-us/library/bb190764.aspx for more information.Countersign
C
0

I have a couple more things to try as I eventually got remote debugging to work but it was tricky:

  • Be aware of the user that is running Visual Studio, by default I run it as Administrator, I had to run as my local domain user to connect
  • At this stage I was able not able to connect to the other domain yet but as an intermediate step I entered the Qualifier of a server on my domain and was able to see those processes
  • Now I changed the Qualifier to the IP Address of the other domain (didn't need to enter 4020 port number) and hit the Refresh button and lo and behold I was prompted to enter the credentials of an account on the other domain
  • This worked and I was able to see the processes to connect to
  • I was not able to get the login screen without the prior step of entering a server on my domain
Circassian answered 1/3, 2017 at 10:49 Comment(0)
K
0

I tried those answers related to Visual Studio here with no luck (VS 2022).

Then I tried Jetbrains remote debugger it was so easy...

On the remote machine I just execute this script which wrote IP, port and credentials to the output and then I enter those credentials into Rider Remote SSH connection. It just worked.

I am using .NET core 6 + Windows Server 2019 (on remote)

https://www.jetbrains.com/help/rider/SSH_Remote_Debugging.html#set-up-ssh-server-on-the-remote-machine

Knuth answered 20/10, 2023 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.