简体   繁体   English

无法从 Visual Studio 2015 连接到 FTP

[英]Cannot connect to FTP from Visual Studio 2015

I have an FTP server setup on a custom port rather than port 21. Now I'm able to connect to it remotely using an IP and the new port set using FileZilla, which is set to passive mode.我在自定义端口而不是端口 21 上设置了 FTP 服务器。现在我可以使用 IP 和使用 FileZilla 设置的新端口远程连接到它,该端口设置为被动模式。 Everything works as expected in FileZilla, but when I try using the same credentials in Microsoft Visual Studio Community 2015, I get this error在 FileZilla 中一切正常,但是当我尝试在 Microsoft Visual Studio Community 2015 中使用相同的凭据时,出现此错误

Unable to retrieve folder information from the server.无法从服务器检索文件夹信息。 FTP Passive mode is not available. FTP 被动模式不可用。

If I turn the passive mode off, I get this error:如果我关闭被动模式,则会收到此错误:

Unable to retrieve folder information from the server.无法从服务器检索文件夹信息。 Illegal PORT command (500).非法 PORT 命令 (500)。

My goal in all this is to quickly modify and upload the files on the server I change without having to go through FileZilla.我的目标是快速修改和上传我更改的服务器上的文件,而无需通过 FileZilla。 The reason VS specific is for C++ development environment. VS 特定的原因是针对 C++ 开发环境。 Potentially I'm setting it up incorrect, but I've looked online and I've done File>Website and added the credentials there.可能我的设置不正确,但我已经在网上查看并完成了文件>网站并在那里添加了凭据。 Tried completed disabling my firewall, no luck.尝试完成禁用我的防火墙,没有运气。 I know the port is good otherwise I wouldn't be able to connect via FileZilla.我知道端口很好,否则我将无法通过 FileZilla 连接。 Just running out of ideas what to do as it works in one case but not the other.只是没有想法该怎么做,因为它在一种情况下有效,但在另一种情况下无效。 Any help is very much appreciated.很感谢任何形式的帮助。

FileZilla log: FileZilla 日志:

Status: Connecting to XXX.XXX.XXX.XXX:XXX...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Status: Server sent passive reply with unroutable address. Using server address instead.
Status: Directory listing of "/home/<USER>" successful

Server sent passive reply with unroutable address服务器发送带有不可路由地址的被动回复

That means your server is misconfigured.这意味着您的服务器配置错误。 It does not know it's external IP address.它不知道它的外部 IP 地址。 It reports local (as of the server) IP address to the client in the response to the PASV command.它在响应PASV命令时向客户端报告本地(从服务器开始)IP 地址。 The client obviously cannot connect to that address to start a data transfer.客户端显然无法连接到该地址以启动数据传输。

See my article on network configuration for FTP passive mode for details.有关详细信息,请参阅我关于FTP 被动模式的网络配置的文章。

FileZilla, when receiving an unroutable IP address, uses the IP address of the FTP server for the data transfer. FileZilla 在收到不可路由的 IP 地址时,使用 FTP 服务器的 IP 地址进行数据传输。 But that's just heuristics, that does not have any backing in the FTP specification.但这只是启发式方法,在 FTP 规范中没有任何支持。 I assume that the Visual Studio (as all Microsoft implementations of FTP protocol do) strictly adheres to the FTP specification.我假设 Visual Studio(就像所有 Microsoft 实现的 FTP 协议一样)严格遵守 FTP 规范。 It does not do anything "smart" like FileZilla and simply fails (what is actually the "correct" behavior).它没有像 FileZilla 那样做任何“聪明”的事情,只是失败了(实际上是“正确”的行为)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM