Samarth Bharadwaj
Samarth Bharadwaj

Reputation: 569

Remote Debugger over internet (Remote IP machine)

My setup: Local PC: x86 vista & visual studio Client server: x64 server ( static ip ).

Currently I connect with it using Remote desktop. Remote Debugger is running as service and there is a user name with login as service privilege.

Can I configure remote debugger to this setup?

Guides, experiences will make my life little less of a hell. Thanks.

Upvotes: 16

Views: 15732

Answers (4)

T.Todua
T.Todua

Reputation: 56557

No 3rd party apps needed!

(I advise to follow this tutorial, especially the bottom part titled "Set up the remote debugger"). However, to say shortly, after installing Remote Debugging Tools on remote machine, run it with administrator privilegges and then:

  • Open up Windows Firewall settings page

  • Click Advanced Settings and there will show up such window: enter image description here

  • Click Inbound Rules->New Rule and choose on the following pages:
    - [Rule Type] Custom
    - [Program] Specific program (and choose : C:\Program Files\Visual Studio\Common7\IDE\Remote Debugger\x64\msvsmon.exe or whatever is your correct path, also note x86/x64 your desired route)
    - [Protocol and Ports] Skip that page by clicking Next (or for maximum security, you can actually choose the exact port that Remote Debugger window is showing)
    - [Scope] Choose in the second field (where it says Which REMOTE IP..) your current IP address
    - [Action] Allow connection
    - [Profile] Next
    - [Name] whatever slug you want to identify, i.e. My rule for VS

  • The last step what you might need, is to set the Junction (hardlink) for folder on remote machine to correctly resolve the application files:
    * When connecting with Remote-Desktop, share drive from Local Resources > More > Drives > C
    * After you connect, on remote "My PC" there will appear your "mapped drive" and copy it's location (i.e. \\RobertoPC\). Then open CMD with admin privilegges and execute:

    mklink /D C:\my_folder \\RobertoPC\C\my_folder

  • On your local PC C: drive create a folder my_folder and put the project into that folder, and run the project with remote debugging option:

enter image description here

Upvotes: 2

ceztko
ceztko

Reputation: 15237

For me it just worked over a public ip address. Ensure Visual Studio remote tools will open firewall ports for all relevant networks when installing. Also ensure the connection target public IP address is written with the TCP port (the default for VS2019 is 4024) when listing processes.

enter image description here

Upvotes: 3

Jemes
Jemes

Reputation: 2842

There's no way to channel your debugger to work over Remote Desktop.

Check out How to: Set Up Remote Debugging, specifically the "Configuring the Windows Firewall" section. You will need make sure you can connect to the correct ports, which will require Software and/or Hardware firewall changes. A VPN could be part of the solution (as @Hans Passant suggested in his comment).

A simpler answer may be to install Visual Studio on a machine within the same network as where you're trying to debug. Then your debugger is making a local connection and you are still interacting with the remote network via Remote Desktop. I'm not sure if this is an option.

Upvotes: 1

Robert Hyatt
Robert Hyatt

Reputation: 791

I had a similar problem, and like Hans Passant said above, a VPN is necessary. I was able to attach to the process and debug over the internet by doing the following:

  1. Install the latest microsoft remote debugger on the server.
  2. Install Hamachi on both my local machine and the server and connect so that I was on the same network.
  3. Go to Debug->Attach To Process on my local machine's Visual studios and enter the Hamachi IP address of the server.
  4. Pick "show processes from all users" and pick the process in question.

Note: I was logged in as the exact same user on both machines and had the same password on each.

I hope that helps someone out there.

Upvotes: 15

Related Questions