C#SSH.NET连接报错"value cannot be null All lists either null or empty"

用网上找到的SSH.NET连接远程FTP主机,大致代码如下:

using Renci.SshNet;
using Renci.SshNet.Common;

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
string user_Name = config.AppSettings.Settings["SSHUserName"].Value;
string passWord = config.AppSettings.Settings["SSHpassword"].Value;
string server_Ip = config.AppSettings.Settings["ftpServer"].Value;
PasswordConnectionInfo sshConnectionInfo = new PasswordConnectionInfo(server_Ip, user_Name, passWord);
SshClient cSSH = new SshClient(sshConnectionInfo);
cSSH.Connect();
SshCommand exec = cSSH.RunCommand("locate " + this.cbBoxName.Text);
string All_result = exec.Result; // shell 返回结果是一个String

然后就在

cSSH.Connect();

这里报错,保存信息如下:

Value cannot be null or empty,All lists either null or empty
at Renci.SshNet.KeyboardInteractiveAuthenticationMethod.Authenticate(Session session)
at Renci.SshNet.ConnectionInfo.Authenticate(Session session)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()

解决方法,换上SSH.NET最新版本的dll,最新版本为2016.1.0-beta2,更新于2017年8月17日,下载链接:SSH.NET最新dll集合(2017年8月)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值