C#/ Tamir.SharpSsh:System.IO.IOException:管道关闭
问题描述:
我正在使用Tamir.SharpSsh
上传文件到ssh服务器,下面的代码,但我得到System.IO.IOException: Pipe closed.
任何线索为什么?C#/ Tamir.SharpSsh:System.IO.IOException:管道关闭
SshTransferProtocolBase scp = new Scp(SSH_HOST, SSH_USER);
scp.Password = SSH_PASSWORD;
scp.Connect();
foreach (string file in files)
{
string remotePath = "incoming/" + new FileInfo(file).Name;
scp.Put(file, remotePath);
}
scp.Close();
问候 /尼尔斯
答
对于将来的参考:显然服务器只接受Sftp连接。所以我改为:
SshTransferProtocolBase scp = new Sftp(SSH_HOST, SSH_USER);
答
听起来像它可能与远程服务器上的操作权限。
答
当试图传输文件时,我遇到了完全相同的问题(“管道关闭”)。
更改为
Sftp scp = new Sftp(SSH_HOST, SSH_USER);
解决了这个问题。
谢谢
Stefano