我能够连接到 sftp 服务器,并且能够获取“pickup”目录中的文件列表。但我无法下载任何这些文件。这是我的代码:
try
{
sftp.Get(txtRemotePath.Text + txtFixedFileName.Text, txtLocalPath.Text + txtFixedFileName.Text);
//example:
//txtRemotePath.Text + txtFixedFileName.Text = "/pickup/temp.txt";
//txtLocalPath.Text + txtFixedFileName.Text = @"C:\Users\...\temp.txt"
}
catch (Exception ex)
{
lblError.Text += "\n" + ex.Message;
}
我尝试修改在斜杠“/”和反斜杠“\”之间切换的本地和远程路径,在远程路径中删除/添加起始斜杠..不幸的是,生成了相同的错误:
引发了“Tamir.SharpSsh.jsch.SftpException”类型的异常