c# - "Server cannot accept argument"Azure VM 中 IIS 中的 FTP 服务器引发异常

标签 c# azure iis ftp azure-virtual-machine

按照我用来连接到 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 包进行开发。

  1. Visual Studio 抛出的错误

The error Thrown by Visual Studio

  • FTP 防火墙支持
  • FTP Firewall support

  • 防火墙入站规则
  • Firewall Inbound Rules

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

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

    最佳答案

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

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

    关于c# - "Server cannot accept argument"Azure VM 中 IIS 中的 FTP 服务器引发异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42523510/

    相关文章:

    c# - 逆变参数?

    reactjs - 如何从 React Web 应用程序将文件上传到 azure blob?

    iis - 了解 IIS 7 日志文件

    iis - 使用 IIS Url Rewrite 2.0 和 ARR 重写自定义标记属性

    iis - 从 web.config 设置文件的 MIME 类型

    c# - 使用 AutoMapper 映射类数组

    c# - 如何找出 ASP.NET MVC View 中的错误计数?

    c# - 我的文本框上没有显示水平滚动条

    c# - Azure .NET MVC 核心应用程序 : User not being redirected upon form submission

    azure - 使用 Microsoft Azure 认知服务 API 收到 401/404 错误