Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Azure App Service - connection attempt failed

If the code works in other environments, I'm quite sure that no change in the code will help to make it working on Azure. This looks like a firewall issue.
lnl@energidanmark.dk

Azure App Service - connection attempt failed

The Solution in short:

App Service running .NET App
Always on is set to On.

The app is downloading file and fileinfo from FTP server using WinSCP in the C# code.

From Log file:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

It seems to fail at the code part:
var sessionOptions = new SessionOptions()
{
    Protocol = Protocol.Ftp,
    HostName = _hostName,
    UserName = _userName,
    Password = _password,
    TimeoutInMilliseconds = 60000,                   
};
_session = new Session();
_session.DisableVersionCheck = true;
_session.DebugLogLevel = 0;
_session.ExecutablePath =
    Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "winscp.exe");
_session.Open(sessionOptions)

The error only occurs when vi run the App on Azure, I cannot recreate the error in Debug on my local machine. If I debug the App local, it seems to get the production App on Azure to start running.

I do not know if I have to change the WinSCP settings in the code, or I should change the settings in Azure App Service.