小编Max*_*ers的帖子

使用 SSH.NET 将数据从内存上传到 SFTP 服务器

我希望将 PDF 直接写入 SFTP 站点。PDF 是从ReportExecutionService.Render(SSRS) 生成的。

ReportExecutionService rsExec = new ReportExecutionService();
Run Code Online (Sandbox Code Playgroud)

我已经能够使用在本地写入文件FileStream。我正在生成数百万个文件,因此我希望使用 SSH.NET 直接将它们写入 SFTP 上。rsExec.Render使用 SSH.NET 获取结果并写入 SFTP 的语法是什么?

string deviceInfo = null;
string extension;
string encoding;
string mimeType;
ConsoleApp2.ReportExecution2005.Warning[] warnings = null;
string[] streamIDs = null;
string format = "PDF";

Byte[] results =
    rsExec.Render(
        format, deviceInfo, out extension, out mimeType, out encoding,
        out warnings, out streamIDs);
FileStream stream = File.OpenWrite("C:\\test.pdf");
stream.Write(results, 0, results.Length);
stream.Close();
Run Code Online (Sandbox Code Playgroud)

.net c# sftp ssh.net

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net ×1

c# ×1

sftp ×1

ssh.net ×1