Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从Azure函数将文件上载到SFTP位置_C#_Azure Functions_Sftp - Fatal编程技术网

C# 从Azure函数将文件上载到SFTP位置

C# 从Azure函数将文件上载到SFTP位置,c#,azure-functions,sftp,C#,Azure Functions,Sftp,我正在使用Azure Functions 2.0,我需要从CosmosDB获取文档,将它们格式化为单个CSV文件,然后将其上载到SFTP位置 我能够通过CosmosDB输入绑定查询和获取文档,并且可能会使用CSVHelper库来处理CSV格式。但我似乎找不到SFTP输出绑定。我查过: 显然,以前有一个外部文件触发器/绑定已被弃用() 从Azure函数将文件流式上载到SFTP位置的最佳方式是什么?根据我的研究,目前Azure函数不提供SFTP绑定。所以,若你们想上传文件到SFTP服务器,你们需

我正在使用Azure Functions 2.0,我需要从CosmosDB获取文档,将它们格式化为单个CSV文件,然后将其上载到SFTP位置

我能够通过CosmosDB输入绑定查询和获取文档,并且可能会使用CSVHelper库来处理CSV格式。但我似乎找不到SFTP输出绑定。我查过:

显然,以前有一个外部文件触发器/绑定已被弃用()


从Azure函数将文件流式上载到SFTP位置的最佳方式是什么?

根据我的研究,目前Azure函数不提供SFTP绑定。所以,若你们想上传文件到SFTP服务器,你们需要用你们的代码实现ii。关于如何实现它,您可以使用。比如说

            string host = ""; // your server name
            int port =22 ;// your port
            string username ="";// your sftp server username
            string password="";// your sftp server  password
            SftpClient client = new SftpClient(host, port, username, password);
            client.Connect();
            string path = "";// The file to write to
            byte[] bytes = Encoding.UTF8.GetBytes("test");
            client.WriteAllBytes(path, bytes);
            client.Dispose();
            client.Disconnect();

我也找不到SFTP的任何绑定,并已在一个问题中询问。同时,我使用了一个稍微不同的实现,但仍然使用SSH.NET,正如您在这里所建议的那样。