无法在 Azure 上的 IIS FTP 服务器上列出目录,即使在配置 Azure 入站规则和 Windows 防火墙之后也是如此

Cannot list directory on IIS FTP server on Azure, even after configuring Azure inbound rules and Windows firewall

我是 Azure 中的 运行 Windows Server 2012,我已经在 IIS 中配置了 FTP 服务器。当我尝试连接服务器时,它接受用户名和密码并登录但不显示目录列表。

  1. 我试过使用 FileZilla FTP 客户端进行连接,它说同样的错误。

    Status: Resolving address of jothiprakashanandan.southindia.cloudapp.azure.com
    Status: Connecting to 104.211.244.241:21...
    Status: Connection established, waiting for welcome message...
    Status: Insecure server, it does not support FTP over TLS.
    Status: Logged in
    Status: Retrieving directory listing...
    Command:    PWD
    Response:   257 "/" is current directory.
    Command:    TYPE I
    Response:   200 Type set to I.
    Command:    PASV
    Error:  Connection timed out after 20 seconds of inactivity
    Error:  Failed to retrieve directory listing
    Status: Disconnected from server
    
  2. Azure的入站规则是这样的:

  3. 虚拟机的防火墙入站规则。

  4. 然而,当我尝试从 VM 的浏览器登录时,它工作正常并显示目录列表。

在Windows防火墙中启用FTP服务器规则后,通常需要重新启动Microsoft FTP服务才能进行更改生效。

或者重启一整台机器

参见我的指南Installing an FTP Server on Windows using IIS

在Azure中,我们应该部署被动模式FTP,我们应该添加数据通道端口范围FTP 防火墙支持,然后将这些端口添加到 NSGwindows 防火墙入站规则.

顺便说一下,虽然 windows 防火墙似乎允许所有需要的流量,但我们还需要在防火墙上启用有状态 FTP 过滤:

netsh advfirewall set global StatefulFtp enable

然后重新启动 FTP windows 服务,我们应该启动 运行:

net stop ftpsvc
net start ftpsvc

这里有一个类似的case,和你一样的错误,请参考。

检查 FTP 站点侦听的端口:

问题出在 Azure 网络 NSG 上。您需要启用传输数据的端口范围。

在 NSG 中添加了新规则以打开此端口范围并且有效。