IIS 8.5 FTP - "501 Server cannot accept argument" in response to PORT command
Your FTP client (FileZilla) sends a local network IP address in the PORT
command. A remote FTP server cannot connect a local address in a different network.
You have to configure your client to report an external IP address. In FileZilla, go to Edit > Settings > Connection > FTP > Active mode > Active mode IP.
And you will have to configure your local firewall and/or NAT to allow/route the incoming connections. Actually it hardly makes sense. No one uses Active FTP mode these days, exactly for this reason.
Related videos on Youtube
Comments
-
Asela over 1 year
I am running IIS 8.5 on Windows 2012 R2.
I created an FTP site to use port 8021 and when trying to connect using FileZilla (plain FTP), I get the error message "Connection timed out after 20 seconds of inactivity. Failed to retrieve directory listing". I am using Active mode in FileZilla, but in FileZilla connection window it shows that it automatically switches to Passive mode. Any idea why? Do I have to configure anything in IIS to not use Passive mode?
14:19:39 Status: Connecting to ip:8021... 14:19:40 Status: Connection established, waiting for welcome message... 14:19:41 Status: Logged in 14:19:41 Status: Retrieving directory listing... 14:20:02 Command: PWD 14:20:02 Response: 257 "/" is current directory. 14:20:02 Command: TYPE I 14:20:02 Response: 200 Type set to I. 14:20:02 Command: PORT 10,0,1,16,5,64 14:20:02 Response: 501 Server cannot accept argument. 14:20:02 Command: PASV 14:20:02 Response: 227 Entering Passive Mode (ip,250,68). 14:20:02 Command: LIST 14:20:02 Response: 150 Opening BINARY mode data connection. 14:20:02 Error: Connection timed out after 20 seconds of inactivity 14:20:02 Error: Failed to retrieve directory listing
Thanks in advance.
Update: Tried Passive mode and still no luck,
09:27:20 Status: Connecting to ip:8021... 09:27:21 Status: Connection established, waiting for welcome message... 09:27:22 Status: Logged in 09:27:22 Status: Retrieving directory listing... 09:27:42 Command: PWD 09:27:42 Response: 257 "/" is current directory. 09:27:42 Command: TYPE I 09:27:42 Response: 200 Type set to I. 09:27:42 Command: PASV 09:27:42 Response: 227 Entering Passive Mode (ip,193,17). 09:27:42 Command: LIST 09:27:42 Response: 150 Opening BINARY mode data connection. 09:27:42 Error: Connection timed out after 20 seconds of inactivity 09:27:42 Error: Failed to retrieve directory listing
Update: Solved! https://www.iis.net/learn/publish/using-the-ftp-service/configuring-ftp-firewall-settings-in-iis-7
Added port range to IIS FTP Firewall Support for server node and opened port range in external firewall to allow Passive Mode. Thanks Martin for pointing out
-
Asela about 7 yearsThanks Martin, but I get this issue only with this server, all other active mode connections to other servers work without any configurations.
-
Martin Prikryl about 7 yearsAre those also sessions outside your network? + Show us logs for those sessions.
-
Asela about 7 yearsThis server has an external firewall. I configured IIS FTP Firewall Support to allow Passive Mode and opened those ports in firewall and now it works. Thanks very much for your comments. I was at a loss :)