2017-03-01 54 views
1

以下代码用于连接到FTP服务器。Azure虚拟机中的IIS中的FTP服务器抛出的“服务器无法接受参数”异常

client.Mode = FtpMode.Active; 
client.ActiveModePorts = new Range(10000, 10001); 
client.Connect(ftpModel.ftpServer, ftpModel.ftpPort); 
client.Login(ftpModel.ftpUser, ftpModel.ftpPassword); 

我使用Ftp.dll nuget packaage进行开发。

  1. 误差由Visual Studio抛出该异常

The error Thrown by Visual Studio

  • FTP防火墙支持
  • FTP Firewall support

  • Firewall Inbou第二规则
  • Firewall Inbound Rules

  • 入站天青VM的规则
  • Inbound rules of Azure VM

  • 入站规则中我的本地机器
  • Inbound rule in my local Machine

    回答

    1

    在Azure VM中,我们无法在主动模式下使用FTP,请尝试使用被动模式

    在主动模式FTP中,客户端从一个随机非特权端口(N> 1023)连接到FTP服务器的命令端口端口21.然后,客户端开始侦听端口N + 1并发送FTP命令PORT N + 1到FTP服务器。服务器将然后从它的本地数据端口,这是端口20
    这是出现连接如下连接返回到客户端的指定数据端口:
    enter image description here

    相关问题