Connection refused — a firewall or proxy may be blocking it (ECONNREFUSED) PS C:...

2026年10月10日 19:43 8.68 秒 success

错误信息

API Error: Connection refused — a firewall or proxy may be blocking it (ECONNREFUSED) PS C:\WINDOWS\system32> Test-NetConnection 127.0.0.1:64755 警告: Name resolution of 127.0.0.1:64755 failed ComputerName : 127.0.0.1:64755 RemoteAddress : InterfaceAlias : SourceAddress : PingSucceeded : False

AI 解决方案

原文:API Error: Connection refused — a firewall or proxy may be blocking it (ECONNREFUSED)
译文:API错误:连接被拒绝 — 可能是防火墙或代理阻止了连接(ECONNREFUSED)

🎯 原因分析

❌ 连接被拒绝通常是因为目标端口没有服务在监听或被本地防火墙/代理拦截了,ECONNREFUSED 表明目标服务器未打开该端口。

💡 解决方案

# 1. 先检查本地端口是否有进程在监听
netstat -ano | findstr "64755"

# 2. 确认进程后,可以用如下命令验证连接
Test-NetConnection -ComputerName 127.0.0.1 -Port 64755

# 3. 也可以指定源端口和目标端口测试
Test-NetConnection -ComputerName 127.0.0.1 -Port 64755 -SourcePort 64756

🛡️ 预防措施

  • ✅ 确保服务已启动:在请求前检查所需服务是否正在运行并监听在指定端口。

  • ✅ 使用防火墙日志:启用 Windows 防火墙审计策略,定位拦截连接的规则。