简体   繁体   English

Azure WebJob 控制台应用程序连接到 sftp 站点

[英]Azure WebJob Console App connect to sftp site

I am a new to working with Azure webjob but I have come across an issue.我是使用Azure webjob但我遇到了一个问题。 I have a Console application written in C# in which I connect to an ftp site to download a file.我有一个用 C# 编写的控制台应用程序,我在其中连接到 ftp 站点以下载文件。

As so:如此:

 using (var sftp = new SftpClient(host, username, password))
            {
                sftp.Connect();
                stream = new MemoryStream();
                sftp.DownloadFile(FileName, stream);
                sftp.Disconnect();
            }

When running this locally on visual studio it works fine, But once I build this and run it thru a scheduled webjob it fails to connect to the ftp site.在 Visual Studio 本地运行它时,它工作正常,但是一旦我构建它并通过预定的webjob运行它,它就无法连接到 ftp 站点。

The logs output at this point is :此时的日志输出为:

"The connection was closed by the server: Failed authentication for virtual user: Username (ProtocolError)" “服务器关闭了连接:虚拟用户身份验证失败:用户名(协议错误)”

Any advice on how to resolve this?有关如何解决此问题的任何建议?

I've come across this Failed authentication for virtual user today at work.我今天在工作中遇到了这个Failed authentication for virtual user问题。 In my instance I'm trying to connect to Bloomberg's SFTP server.在我的例子中,我试图连接到彭博的 SFTP 服务器。 My machine was trying to connect to the server from behind an IP not in the IP whitelist we provided Bloomberg.我的机器试图从不在我们提供的彭博 IP 白名单中的 IP 后面连接到服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM