代码:
var connectionInfo = new ConnectionInfo(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_SERVER), Convert.ToInt32(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_PORT)),
Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID),
new PasswordAuthenticationMethod(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID)
, Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_PWD)),
new PrivateKeyAuthenticationMethod(Utilities.GetConfigValueByKey(processName + Constants.KEY_FTP_USERID),
new PrivateKeyFile(File.OpenRead(@"C:\Jobs\Test\id_rsa"), "testpwd"))
);
它在 privateKeyfile 上失败了,有人可以帮助我我做错了什么。
我已经尝试将文件名作为文本文件,但仍然没有运气。