【问题标题】:What could stop default proxy being used什么可以阻止使用默认代理
【发布时间】:2016-07-19 13:34:29
【问题描述】:

因为我的question about manually setting a proxy for the google youtube v3 api 没有产生任何结果。我想我会问一个单独的问题,关于未使用代理的原因是什么。

正如我在另一个问题中所述,我在 web.config 中设置了以下内容:

<defaultProxy useDefaultCredentials="false" enabled="true">
    <proxy usesystemdefault="False" proxyaddress="http://192.111.111.102:8081" />
</defaultProxy>

这应该意味着 google api 将使用指定的代理和端口

但我仍然收到连接被拒绝错误。在与系统团队一起调查后,看起来对 google api 的请求根本没有命中代理。

所以我的新问题是什么会导致此设置被忽略,还有其他设置默认代理的方法吗?

【问题讨论】:

  • 我不记得这是否重要,但可能是假而不是假。
  • 应该是一样的。 @Alex k。
  • @AlexK。不幸的是,我都试过了,没有区别

标签: c# iis proxy


【解决方案1】:

不确定是什么阻止了默认代理的使用,因为它有时会工作,但在其他情况下随机不工作,最后我在默认代理无法工作时进行冗余编码:

private VideoListResponse GetVideoListReponse(string videoIds) 
{
  // this is original call
  VideoListResponse response = GetVideoListReponseFromAPI(videoIds);
  if (response == null) 
  {
    // if original call fails, use a webrequest where I can set the proxy manually
    return GetVideoListReponseFromWebRequest(videoIds);
  } else {
    return response;
  }
}

See this answer for how I set my proxy manually

【讨论】:

    猜你喜欢
    • 2011-12-15
    • 2011-04-25
    • 1970-01-01
    • 1970-01-01
    • 2017-12-16
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多