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 firstname.lastname@example.org Connected to xx.xx.xx.xx 421 Service not available, remote server has closed connection.
From a remote machine, SFTP works:
$ sftp email@example.com firstname.lastname@example.org'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.