question

ronkit-5872 avatar image
0 Votes"
ronkit-5872 asked VenkateshDodda-MSFT commented

FTP/FTPS not working in Docker window container in Azure App Service

Hi,

I am hosting docker in windows container using Azure App Service.

Trying to FTP into an external remote server from docker.

Everything works fine in local pc, it does not work when deployed to Azure App Service.

 System.TimeoutException: Timed out trying to connect! at FluentFTP.FtpSocketStream.Connect(String host, Int32 port, FtpIpVersion ipVersions) at FluentFTP.FtpClient.Connect(FtpSocketStream stream) at FluentFTP.FtpClient.Connect() at

Am using FluentFtp to do it as for now

    FtpClient client = new FtpClient("waws-prod-sg1-067.ftp.azurewebsites.windows.net", 21, @"test", "test");
                 client.EncryptionMode = FtpEncryptionMode.Auto;
                 client.DataConnectionEncryption = true;
                 client.ValidateAnyCertificate = true;
                 client.SslProtocols = SslProtocols.Tls12;
                 client.DataConnectionType = FtpDataConnectionType.EPSV;
                 client.Connect();
                                   
                 await client.UploadBytesAsync(content, "test.xlsx");

Anyone can help or advise on this? Not much resource can be found online.

Thanks

dotnet-adazure-webapps-availability
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

VenkateshDodda-MSFT avatar image
0 Votes"
VenkateshDodda-MSFT answered VenkateshDodda-MSFT commented

@ronkit-5872 Thank you for reaching out to Microsoft Q&A. Can you try connecting to your container using any other FTP clients like (FileZilla, WinSCP, etc) and also, I hope you are using app level credentials while connecting to the webapp container.

Make sure FTP is enabled on your app service. If it is disabled state, I would suggest you enable it by following these documentation steps

Feel Free to reach back to me if you have any further questions on this.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VenkateshDodda-MSFT ,

I am not referring to FTP/FTPS towards the container. I am trying to reach external FTP Server FROM WITHIN the container.
Still getting error on this. Cant seems to reach external FTP server from the container.

Any idea on this?

0 Votes 0 ·

@ronkit-5872 Thanks for your response on this. Based on the shared information i have understood that you are trying to connect to external FTP server from the windows docker container that is deployed on the app Service. Is that external FTP server is also part of Azure? If your external server is hosted on-prem make sure to check that there is no firewall configuration that is blocking the FTP.

From kudu console you can perform FTP, before performing FTP I would suggest checking whether you are able to connect to external server using TCP ping from the container.

You can also utilize curl which is installed in Kudu to test FTP connections to isolate if the issue is happening outside the context of your code.

0 Votes 0 ·
ronkit-5872 avatar image ronkit-5872 VenkateshDodda-MSFT ·

Hi @VenkateshDodda-MSFT ,

You are right. Apparently there is firewall blocking on external FTP server.
It works after allowing the FTP to go through.

Thanks

0 Votes 0 ·
Show more comments