SshConnectionException:“服务器响应不包含SSH协议标识。”

时间:2018-12-19 12:47:19

标签: c# ssh

我尝试通过ssh与树莓派连接,但不幸的是,我收到此错误消息。我尝试像本主题一样使用try-catch,Renci.SshNet : "server response does not contain ssh protocol identification"但这无济于事。当我尝试通过linux上的ssh.client与该设备连接时,一切都能正常工作,因此IP和端口都很好。我在Visual Studio上工作,并且使用Xamarin.forms。

我的代码:

using (var client = new SshClient("11.15.16.385", 24, "root", "password"))
{
    client.Connect();
    client.RunCommand("reboot");
    client.Disconnect();
}

结果:

Error in client.connect():

Renci.SshNet.Common.SshConnectionException: 'Server response does not
contain SSH protocol identification.'

1 个答案:

答案 0 :(得分:1)

这可能是由于您的树莓派发送的响应所致,正如您在source code中看到的那样。可能缺少版本信息。