1

IIS FTP server stopped accepting connections, returning a "421 Service not available, remote server has closed connection." error message after the instance was rebooted. The problem does not appear to be a firewall issue.

I had set up an IIS FTP server on an EC2 instance running Windows Server 2012 R2, IIS version 8.5. My client just wanted plain FTP. (I had previously set up an SFTP server on the same instance, using Cygwin sshd, that is working fine.) I set up the "default" IIS FTP server, and it was working fine for 2 days, until during a file transfer, it hung. The CPU was pegged at 100%, according to the AWS monitor. I could not RDP into the instance, so I had to re-boot it. Ever since, I could not connect to the IIS FTP server. The "ftpsvc" process status is running, according to the task manager. I have stopped and started it several times. The Windows firewall is off, the AWS firewall has ports 20, 21, and 50,000-51,000 open. No settings have been changed since it stopped working.

From a local command prompt on the server instance, FTP fails:

> ftp localhost
Connected to MYINSTANCE
Connection closed by remote host.

From a remote machine, FTP fails:

$ ftp myact@xx.xx.xx.xx
Connected to xx.xx.xx.xx
421 Service not available, remote server has closed connection.

From a remote machine, SFTP works:

$ sftp myact@xx.xx.xx.xx
myact@xx.xx.xx.xx's password: ****
Connected to xx.xx.xx.xx

I am not very familiar with IIS, and the FTP service seems to be running but I don't know why is stopped allowing connections after the instance reboot. Note that the EC2 instance has been assigned an Elastic IP, so its at the same public IP address as before the problem reboot.

Anny advice or suggestions would be greatly appreciated! If I can't solve the problem, I plan to spin up another EC2 instance and set up a new server from scratch.


Thanks for your suggestion Mass Nerder.

The FTP server is writing to inetpub/logs/LogFiles/FTPSVC2, and the newest entry was 5 days old, from 10/16/2014, and it did not contain anything that looked like an error. The IIS Event log was empty. I did notice some periodic sshd errors in the Local Server Events log, but no details at all. Even after I shut down sshd, the FTP service still does not connect.

netstat -anb shows ftpsvc listening on port 21:

Proto  Local Address          Foreign Address        State
TCP    0.0.0.0:21             0.0.0.0:0              LISTENING
ftpsvc

I have created a couple of FTP test users, but still get the same error when trying to connect.

I am going to try a “clean” WinServer 2012 test instance, and see if I can get FTP to work.

1

Sorry, the problem turned out to be an incorrect setting in the IIS FTP-site Site Bindings. EC2 instances have 2 IP addresses, one private and one public. It seems that the FTP server was set with the EC2 instance private IP address, and when the instance re-booted, it got a different private IP, but was re-assigned the same public IP using the Elastic IP feature. Live and learn.

0

According to Microsoft error 421 means

"421 Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down."

https://support.microsoft.com/kb/969061

Have you checked the event log to see if there are any errors relating to this?

does a netstat -anb show that the service is running and listing on the proper ports?

Have you tried with a different user?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.