Tuesday, December 14, 2021

Connection closed by remote host

You may run into this error message when you try to connect an FTP site in Command Prompt: “Connection closed by remote host”.



For the same issue, a third-party FTP client showed this error:

Connection failed. FlowSocketConnector: Failed to conect to target address. Windows error 10060



For the server I checked, this issue started occurring after migrating the site from Windows Server 2008 to 2016.



I’d recommend checking the Event Viewer logs first. You may see these error messages there:


Event ID 10
An error has occurred: The configuration section ‘system.ftpServer/security/authentication’ cannot be read



I saw two warnings that followed the event above:

Event ID 12
Unable to find schema for config section ‘system.xaml.hosting/httpHandlers’.

Event ID 12
Unable to find schema for config section ‘system.serviceModel/client’.


Additionally, IIS Manager showed this error:

Filename: applicationHost.config. Error: Cannot add duplicate collection entry of type ‘add’




For the case I worked on, the cause of this issue was this missing line in the applicationHost.config file:


<section name="authentication" overrideModeDefault="Deny" />


FTP site started working after adding the line.


Note: This line was missing because it didn’t exist in the Windows Server 2008 server at all. It was in the config file for Windows Server 2016 machine but once the site configuration is migrated using Web Deploy from 2008 to 2016 server, the line was removed.

Posted at https://sl.advdat.com/3oRv5IW