Connection timeout when Web API deployed to Absolute Hosting

Have the feeling that everybody is staring at you in the other forums? Then look here, in this forum nobody does care what you say ;-)

Moderator: Project members

Post Reply
Message
Author
luffyretro
500 Command not understood
Posts: 1
Joined: 2019-10-04 13:59
First name: Ntwampe
Last name: Mampuru

Connection timeout when Web API deployed to Absolute Hosting

#1 Post by luffyretro » 2019-10-08 19:34

HI

I'm having trouble connect to the FTP server with my Dot Net Core 2 application it always times out funny thing is that I only experience the timing out issue when I deploy the Web API to the server on Absolute Hosting. When i connect to the FTP server via Filezilla it works fine, when i run the Web API locally on my machine and connect to the FTP server it works fine. Fixes I've tried: I removed the upload file size,increased the timeout interval,passed the SSL config setting.It still fails to connect when it is deployed to the server.

To connect to the FTP server in the Web API I'm using the FluentFTP nuget package.In the code i login to FTP server,Create a directory in the "wwwroot" folder, then upload file.Is there anything you can do on your side that can help.

My code is as follows:

Code: Select all

 FtpClient client;
            try
            {
                client = new FtpClient(clientIP)
                {
                    Port = 11000,
                    Credentials = new NetworkCredential(Username, Password)
                };

                client.Connect(); //Times out on this line

            }
            catch ( Exception e)
            {
                Console.WriteLine(e);
                return (StatusCode(500, new { error = e.StackTrace, message = "Failed to create FTP Client" }));
                
            }
            try
            {
                foreach (var activityFile in activity.Files.ToList())
                {
                    if (activityFile.Length <= 0)
                    {
                        continue;
                    }
                    using (var ms = new MemoryStream())
                    {
                        activityFile.CopyTo(ms);
                        var fileBytes = ms.ToArray();
                        string yearFolder = todaysDate.Year.ToString();
                        string monthFolder = todaysDate.Month.ToString();
                        var directory = path + yearFolder + "/" + monthFolder + "/";
                        if (!(await client.DirectoryExistsAsync(directory)))
                        {
                            await client.CreateDirectoryAsync(directory);
                        }

User avatar
botg
Site Admin
Posts: 35492
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Connection timeout when Web API deployed to Absolute Hosting

#2 Post by botg » 2019-10-08 21:42

Clearly something wrong with your client. Try using a better programming language. Does that fix your problem?

Post Reply