No connection could be made because the target machine actively refused it.

  • 1
  • Question
  • Updated 8 months ago
We have an automated job that copies a ZIP backup file to Sharefile on four different systems, running Windows Server 2012 or 2008. We are running WinSCP 5.13.5 (command line) to upload the files using 4 different Sharefile user accounts via a scheduled task and we are using Sharefile "notify on file uploaded" e-mails to monitor success. On any given day usually at least one, sometimes two jobs fail.

We were experiencing some timeout errors and increased the timeout to 60 seconds, that seems to have dealt with that issue. Now we are getting the error "No connection could be made because the target machine actively refused it.". I put the FTP upload job into a retry loop and recently we had a failure even after 3 attempts. We are using FTP in Passive mode to do the copy.

The jobs run at 4:00AM Eastern time. Later in the morning, between 8:00 and 9:00, I check the status of the job and if any have failed I log in via RDP and kick off the upload job again and usually it succeeds with one attempt.

Of the four systems, one is at a client site, one is hosted on Azure and two is in our own small data center. Errors will occur randomly from each of these locations and as I mentioned earlier, the FTP job seems to work fine several hours later or the next day without us making any changes.

Googling the text of that error on WinSCP forums, they seem to indicate that the "connection refused" error can also be the result of any firewall or router between the two systems blocking one of the data ports. Since FTP randomly uses a large block of high numbered ports maybe based on the time of day, network traffic or system load we wind up taking different network routes between the systems and one or more of them doesn't allow all the traffic through. Does this sound feasible? It would have to be something closer or in the Sharefile / Citrix network as we have three systems on widely separated / disparate networks all getting the error.

Any ideas? Next to try is to slow down the retry attempts (maybe wait 30 minutes) and increase the retry count. Are there any other options to correct this that anyone can think of or something different to try altogether? SFTP uses a single connection, but doesn't appear to be supported. Would FTPS have the same problem due to the multiple connections required?

Also, on the Related Categories list below - no FTP? FTP is as old as the hills and is usually pretty reliable.

We have an open case with Sharefile support, which they are escalating,
but they recommend we post here too for a wider audience.
Photo of Rob J

Rob J

  • 1 Post
  • 0 Reply Likes
  • perlexed.

Posted 8 months ago

  • 1
Photo of JasonPeter


  • 1 Post
  • 0 Reply Likes
We have a client that uses FTPS as well and has been having intermittent issues and finally reported it to us with that same specific error message.  I opened a ticket w/Citrix and the are inviting my client to call them and discuss.  This client is using some sort of scripting in Unix I believe to connect and trying to automate.  When it fails it is a bit of a hassle for them.
Photo of Michael


  • 1 Post
  • 0 Reply Likes
Hello - I am experiencing the same problem.  I have one account.  I do not upload many files - usually 5 or less in a given day.  The connection has always been 'slow' to connect.  Today I have not been able to connect 2x.  All the other times I'm getting the 'No Connection could be made because the...' message.

I have also opened a case with Support.  Please post your findings here if you discover a solution.  I will do the same.