ftp到Azure Webjob中的外部服务器不起作用 [英] Ftp to external server in azure webjob not working

查看:70
本文介绍了ftp到Azure Webjob中的外部服务器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在本地计算机上正常运行的代码,但是在Azure中,它抛出无法连接到远程服务器",我从sql获取数据,对其进行处理,然后通过ftp上传到外部服务器,在Azure中需要对FTP进行任何设置吗?

I have a code which runs fine in local machine however in Azure it throws "Unable to connect to remote server", I 'm getting data from sql,processing it, and then uploading to a external server via ftp, is there any settings needs to be done for FTP in Azure ?

代码:

FtpWebRequest request =
    (FtpWebRequest)WebRequest.Create("ftp://ftp.example.com/remote/path/file.zip");
request.Credentials = new NetworkCredential("username", "password");
request.Method = WebRequestMethods.Ftp.UploadFile;  

using (Stream fileStream = File.OpenRead(csvfilestring))
using (Stream ftpStream = request.GetRequestStream())
{
    fileStream.CopyTo(ftpStream);
}

推荐答案

在使用天蓝色的webjob的情况下,FtpWebRequest实例配置应用程序,以便它使用公共IP地址与外部FTP服务器对话以获取套接字.上传文件.因此,请检查您正在使用的端口.

In the case of the azure webjob, the FtpWebRequest instance configure the application so it dialog with the external FTP server using a public IP adress to get a socket to upload the files. So check what you port you are using.

如果您还没有尝试过

If you have not tried the following steps described in link, kindly try to do that and let us know the status.

此外,您可以启用Web应用程序的诊断日志,并检查问题所在的日志.

Also, you could enable the diagnostics log for web app and check the log where you have the problem.

这篇关于ftp到Azure Webjob中的外部服务器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆