首页 > 解决方案 > Azure 函数将文件发送到 sftp 服务器

问题描述

我遇到了用于连接 sftp 服务器的https://github.com/sshnet/SSH.NET库,但是它说它仅与 .net 框架兼容,而我们使用 .net 核心来编写 azure 函数。有人知道其他方法吗?另外,一旦我连接到服务器,如何将文件发送到服务器。

标签: azure.net-coreazure-functions

解决方案


已成功将Renci.SshNet与 Azure Functions 一起使用。

上传很简单:

var connectionInfo = new ConnectionInfo(
      config["SftpHostname"], 
      username, 
      new PasswordAuthenticationMethod(username, config["SftpPassword"]
    ));
sftpClient = new SftpClient(connectionInfo);
sftpClient.Connect();
sftpClient.UploadFile(requestFile, filePath);

推荐阅读