SSH.NETlocalhost:3306
を使用して、リモート マシンのポート 3306 へのトンネルを作成しようとしています。
PrivateKeyFile file = new PrivateKeyFile(@" .. path to private key .. ");
using (var client = new SshClient(" .. remote server .. ", "ubuntu", file))
{
client.Connect();
var port = new ForwardedPortLocal(3306, "localhost", 3306);
client.AddForwardedPort(port);
port.Start();
// breakpoint set within the code here
client.Disconnect();
}
ブレークポイントにヒットすると、client.IsConnected
が返されますがtrue
、telnet localhost 3306
接続されていません。代わりに Putty を使用して接続を作成し、そこに同じトンネルをセットアップすると、成功します。私は何を逃したのですか?