I am downloading a file from an ftp usin FLuentFtp. If I call the synchroneous methods:
client.Connect();
var status = client.DownloadFile(localPath, ftpPath);
then it works but the asynchroneous versions namely:
await client.ConnectAsync();
FtpStatus status = client.DownloadFileAsync(localPath, ftpPath).Result;
both don't work. Neither throw an exception but they don't complete within 2 minutes where the synchroneous versions take 2 seconds.
Could it be that there isn't a thread available to run these methods, and if so how can I check this.
The TaskState is WaitingForActivation if that helps narrow things down.
I think, you have a deadlock in line:
client.DownloadFileAsync(localPath, ftpPath).Result;
You should call it with await:
FtpStatus status = await client.DownloadFileAsync(localPath, ftpPath);