无法建立连接,因为目标机器主动拒绝 216.58.212.106:443

No connection could be made because the target machine actively refused it 216.58.212.106:443

我使用 C# 创建了 windows 服务以从 Google QPX Express 中提取最低票价数据。该程序在调试模式下运行,但是当我在我的机器上安装时它出现 无法建立连接,因为目标机器主动拒绝。这是我在 App.Config 文件中插入的代码。

<system.net>
  <defaultProxy useDefaultCredentials="true">
    <proxy usesystemdefault="True"  bypassonlocal="True" />
  </defaultProxy>
</system.net>

我已经使用以下配置解决了这个问题。

<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="True"  bypassonlocal="True" proxyaddress="http://server:port" />
</defaultProxy>
</system.net>

并在本地系统帐户上将服务配置为 运行,安装服务后提供用户名和密码