0

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);
}
harsh
  • 43
  • 1
  • 6

1 Answers1

0

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.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30