WebJob: FtpWebRequest to remote server always fail since a few weeks
Hello there
I have some code implemented into my app logic pulling some CSV files from a partner FTP server.
This code has been working for a while, but it just stopped working over the past few weeks.
The code is fairly simple and just connect to an FTP endpoint to download a file:
var path = ConfigurationManager.AppSettings["ftpFilePath"];
var request = (FtpWebRequest)WebRequest.Create(path);
request.Method = WebRequestMethods.Ftp.DownloadFile;
var response = (FtpWebResponse)request.GetResponse();
var responseStream = response.GetResponseStream();
var reader = new StreamReader(responseStream);
var fileContent = reader.ReadToEnd();
This just topped working, giving this error:
Unhandled Exception: System.Net.WebException: Unable to connect to the remote server
I also tried another lib (FluentFTP) to see how that would work, and kind of a similar error came up:
Unhandled Exception: System.TimeoutException: Timed out trying to connect!
Both piece of code connecting to the FTP server I am using work locally without any issues.
Using my Command Line based app into WebJobs just flat-out fails with the errors posted above.
This indicates a change in how connections are done to the outside from within an App Service, is there anything done recently that could make this happen?
Any ideas?
Thanks!