Search code examples
.netvisual-studiosshssh-tunnel

How to debug an application by using Visual Studio through the ssh-tunnel


I have:

  1. Local windows 10 with VS2017
  2. Remote Debian-1 with access from a local machine
  3. Remote Debian-2 with access from a Debian-1 and .NET Core Console app

How to attach from local Windows 10 to Debian-2 by using ssh tunnel for debug?


Solution

  • I found a solution.

    1. Set the following settings for the PuTTY tunnel. Source port: 12345, Destination: localhost:12345, Local, Auto
    2. After establishing connection with Debian-1 execute the following command ssh -L 12345:localhost:22 user@debian2
    3. In Visual Studio. Debug->Attach to process. Select connection type to ssh. Connection target localhost:12345