Troubleshooting Azure App Service FTP Login Attempt Issues

Working on a service hosted on Azure App Service and using Azure App Service as FTP I had an issue while downloading multiple files in a loop. After few successfull connections FluentFTP was throwing an error that user cannot log in, and no matter how many retries were specified in FluentFTP options it could not recover. Having some brief investigation, conclusion was that FTP server is an issue here. Thread on Microsoft MSDN (Msdn Thread) stated that 3 connections per second is a limit and since in FTP manner, one CRUD operation is one connection and doing that in a loop, we were easily exceding this limit.

530 User cannot log in log trace:

Workaround to this issue is to use Retry Pattern, which in our case was Polly library. After implementing Polly retry pattern we could successfully complete required operation and longest wait time was 8 seconds until it recovered and logged in correctly to complete download from FTP.

Mockup code below uses Polly with maximum 5 attempts until circuit breaks, each attempt retry wait time is increased by 2 seconds. Unsuccessfull attempt is logged as warning with details about error and total duration time.

References

  1. My StackOverflow Post
  2. MSDN Thread