Ftp to external server in azure webjob not working

那年仲夏 提交于 2019-12-10 00:40:30

问题


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 ?

Code :

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);
}

回答1:


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.

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



来源:https://stackoverflow.com/questions/52509590/ftp-to-external-server-in-azure-webjob-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!