如何解决?:«ECONNREFUSED-服务器拒绝连接»

时间:2024-05-19 22:35:32

Chances are that while you've been using FileZilla you've also come across the ECONNREFUSED — connection refused by a server error. If that's the case — great that you've found this tutorial! I am going to show you three methods that might help you with resolving this FTP error.

可能是,当您使用FileZilla时 ,还遇到了ECONNREFUSED —服务器错误拒绝了连接 。 如果是这样的话,很高兴您找到了本教程! 我将向您展示三种可以帮助您解决此FTP错误的方法。

第一种方法。 更改FileZilla的默认端口值 (First Method. Changing FileZilla's Default Port Value)

The error could appear due to using the incorrect port while connecting through FileZilla. In this situation, you just need to change the default FTP port to the default SFTP port number. Simply change 21 to 22 on the "Port" input box.

由于通过FileZilla连接时使用了错误的端口,因此可能会出现错误。 在这种情况下,您只需要将默认的FTP端口更改为默认的SFTP端口号即可。 只需在“ 端口 ”输入框上将21更改为22

如何解决?:«ECONNREFUSED-服务器拒绝连接»

第二种方法。 禁用防病毒/防火墙 (Second Method. Disabling Anti-Virus/Firewall)

Sometimes this error can occur when anti-virus software and/or firewall is refusing FileZilla's tries to make a connection.

有时,当防病毒软件和/或防火墙拒绝FileZilla尝试建立连接时,可能会发生此错误。

In the event where anti-virus or firewall is causing ECONNREFUSED, what you need to do is simple. What you need to do: disable anti-virus and firewall and try to connect again. Firstly I'll show you how to do this on macOS :

如果防病毒或防火墙导致ECONNREFUSED,则您需要做的很简单。 您需要做的是:禁用防病毒和防火墙,然后尝试重新连接。 首先,我将向您展示如何在macOS上执行此操作:

  • Click the "Apple" icon on the top menu bar. Navigate to "System Preferences".

    点击顶部菜单栏上的“ Apple ”图标。 导航到“ 系统偏好设置 ”。

  • Find the "Security & Privacy" settings.

    找到“ 安全和隐私 ”设置。

如何解决?:«ECONNREFUSED-服务器拒绝连接»
  • Go to the "Firewall" tab and select "Turn Off Firewall".

    转到“ 防火墙 ”选项卡,然后选择“ 关闭防火墙 ”。

如何解决?:«ECONNREFUSED-服务器拒绝连接»

If you're using Windows, follow these steps:

如果您使用Windows ,请按照下列步骤操作:

  • Hit the "Windows" key and type in "Control Panel".

    点击“ Windows”键,然后输入“ 控制面板 ”。

  • Then go to "System and Security" and find "Windows Defender Firewall".

    然后转到“ 系统和安全性 ”并找到“ Windows Defender防火墙 ”。

如何解决?:«ECONNREFUSED-服务器拒绝连接»
  • Locate "Turn Windows Defender Firewall on or off" selection on the sidebar on the left.

    在左侧的侧栏中找到“ 打开或关闭Windows Defender防火墙 ”选项。

如何解决?:«ECONNREFUSED-服务器拒绝连接»
  • Alter the options to switch off Windows Defender Firewall for public and private networks, in the following window and click "Ok".

    在以下窗口中,更改用于关闭公共和专用网络的Windows Defender防火墙的选项,然后单击“ 确定 ”。

For a thorough explanation of how to deactivate various anti-virus software, take a look at this post.

有关如何停用各种防病毒软件的详细说明,请参阅此文章

If turning off the anti-virus or firewall doesn't help and you still get the ECONNREFUSED — connection refused by the server error — try the following method.

如果关闭防病毒或防火墙没有帮助,而您仍然得到ECONNREFUSED(服务器错误拒绝连接),请尝试以下方法。

第三种方法。 更改FileZilla的网络配置向导 (Third Method. Altering FileZilla's Network Configuration Wizard)

What should you do if the previous solutions don't bring the desired result? To fix the error, you can try altering FileZilla's network configurations:

如果先前的解决方案无法带来预期的结果,您该怎么办? 要解决该错误,您可以尝试更改FileZilla的网络配置:

如何解决?:«ECONNREFUSED-服务器拒绝连接»
  • When "Firewall and router configuration wizard" window appears, click "Next" to continue.

    当出现“ 防火墙和路由器配置向导 ”窗口时,单击“ 下一步 ”继续。

  • As the Default transfer mode select "Passive (recommended)". Also, tick "Allow fallback to another transfer mode on failure" selection.

    作为默认传输模式,选择“ 被动(推荐) ”。 同样,勾选“ 允许失败时回退到另一种传输模式 ”选择。

如何解决?:«ECONNREFUSED-服务器拒绝连接»
  • Choose "Use server's external IP address instead".

    选择“ 改为使用服务器的外部IP地址 ”。

  • Select the "Get the external IP address from the following URL". Enter the default value in case the input field is empty and continue (default value is http://ip.filezilla-project.org/ip.php).

    选择“ 从以下URL获取外部IP地址 ”。 如果输入字段为空,请输入默认值,然后继续(默认值为http://ip.filezilla-project.org/ip.php )。

  • Do not adjust the port range configuration and then choose the "Ask operating system for a port".

    不要调整端口范围配置,然后选择“ 向操作系统询问端口 ”。

At this point, you need to ensure that you've made correct configurations. Hit the "Test" button to let FileZilla try to make a connection to probe.filezilla-project.org and it will perform some simple benchmarks.

此时,您需要确保已进行正确的配置。 点击“ 测试 ”按钮,让FileZilla尝试建立与probe.filezilla-project.org的连接,它将执行一些简单的基准测试。

If the test goes without any failures, attempt to connect to your hosting account once more. It should work perfectly well. In case the "ECONNREFUSED" error repeats itself, you should try reaching out to your hosting customer support to get some help.

如果测试顺利进行,请尝试再次连接到您的托管帐户。 它应该工作得很好。 如果“ ECONNREFUSED ”错误再次发生,您应该尝试与托管客户支持联系以获取帮助。

结论 (To Conclude)

There you go — three methods of fixing ECONNREFUSED — connection refused by server error. Hopefully, one of these three methods will help you to fix this FileZilla error! If you have questions or more solutions for this error, do not hesitate to leave a comment!

到那里了-修复ECONNREFUSED的三种方法-服务器错误拒绝了连接。 希望这三种方法之一可以帮助您解决此FileZilla错误! 如果您对此错误有疑问或更多解决方案,请随时发表评论!

翻译自: https://habr.com/en/post/491396/