问题场景

在配置Flutter安装环境时,运行flutter doctor时,有这个错误

X HTTP host "https://maven.google.com/" is not reachable. Reason: An error occurred while checking the HTTP host:
信号灯超时时间已到

X HTTP host "https://pub.dev/" is not reachable. Reason: An error occurred while checking the HTTP host: 信号灯超时 时间已到

X HTTP host "https://cloud.google.com/" is not reachable. Reason: An error occurred while checking the HTTP host:
信号灯超时时间已到

原因是无法访问外网的服务器,直接打开MonoCloud,发现还是一样的结果

在Windows下:

使用 MonoCloud 客户端,打开代理设置。

发现打开PowerShell,还是无法访问外网。

netsh winhttp show proxy

查看代理网络设置,这是可以看到,代理是通过127.0.0.1:8888这个端口发出去

取消代理

netsh winhttp reset proxy

然后重新运行flutter doctor ,结果正常

Windows下PowerShell走MonoProxy代理

powershell中运行

$proxyAddress = "http://127.0.0.1:7078"
$wc = New-Object System.Net.WebClient
$wc.Proxy = New-Object System.Net.WebProxy($proxyAddress, $true)

其中proxyaddress中的IP地址和端口为本机已经代理的地址。

image-20230424162547106