抛出 'Tamir.SharpSsh.jsch.SftpException' 类型的异常

Exception of type 'Tamir.SharpSsh.jsch.SftpException' was thrown

我无法连接到 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;
}

我尝试修改本地和远程路径,在斜杠“/”和反斜杠“\”之间切换,removing/addding 远程路径中的起始斜杠.. 不幸的是,产生了同样的错误:

抛出了 'Tamir.SharpSsh.jsch.SftpException' 类型的异常

是 sftp 服务器安全性不允许我下载文件!

检查 sftp 服务器安全性以允许您通过特定端口进入

我在上传文件时收到同样的错误。我意识到我没有根目录的权限。使用具有正确权限的文件夹时,我可以成功上传文件。