English 中文(简体)
407 Proxy Authentication requiredd
原标题:407 Proxy Authentication Required
  • 时间:2009-10-06 09:35:36
  •  标签:

我正在一个网站上工作,在该网站,我利用以下代码,从外部的URL检索XML数据。

WebRequest req = WebRequest.Create("External server url");
req.Proxy = new System.Net.WebProxy("proxyUrl:8080", true);
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
StreamReader textReader = new StreamReader(resp.GetResponseStream());
XmlTextReader xmlReader = new XmlTextReader(textReader);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);

该法典正在对我开发的PC(Windows XP with Net 3.5)进行罚款。

但是,当我向全球导航卫星系统国际系统(在Windows XP和Windows 服务器上布局)部署这一代码时,我会发现错误。

“遥远服务器回归了一个错误:(407) 棱晶体要求”。

有时,这给我带来了好处。

“远程服务器回落了一个错误:(502) Bad Avenue

下面的守则来自我的网络。

<system.net>
    <defaultProxy>
      <proxy  usesystemdefault="False" proxyaddress ="http://172.16.12.12:8080" bypassonlocal ="True" />
    </defaultProxy>
  </system.net> 

请帮助我?

[Edit] Even when i run the website for devlopment PC but through IIS it gives me error "The remote server returned an error: (407) Proxy Authentication Required."

但是,如果从Microsoft Devlopment服务器上运行网站,则会进行罚款。

问题回答

@Mohit Agarwal

许多人因为建议增加使用DefaultCredentials=“true”,你 re!

我一直在努力这样做。 谷歌数据预报样本网络图书馆没有成功,工作几周。 加上你的建议,我就存在问题,而现在我却需要联系,而不是需要407个Proxy Authentication。

书面材料需要:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="true"/>
    </defaultProxy>
  </system.net>
</configuration>

在我的案例NOT中,谷歌显示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.net>
  <defaultProxy>
   <proxy usesystemdefault="true"/>
  </defaultProxy>
 </system.net>
</configuration>

http://code.google.com/p/google-gdata/wiki/WebProxySetup”rel=“noreferer”http://code.google.com/p/google-gdata/wiki/WebProxySetup

如果某人在现场发现这种情况,可能会有所帮助。 谷歌,你可以实际使用。 NET应用软件,可能没有自己的AppName.exe.config文档(如果是的话,可加以修改)。 我们使用下一代EPM(医疗日程安排/账单),他们的信用卡处理系统一直 st在我们的代理服务器上,因为它不会通过证书。 我提交了“EXEName.config”文件(NextGenEPM.exe.config in this case),其中载有上述表格:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="true"/>
    </defaultProxy>
  </system.net>
</configuration>

成功! 这使我得以在我们的代理服务器上不停地解决问题,而代机服务器是需要认证的坚固配置,我们不妥协。

它是否在你改变网上版面时发挥作用。 召集:

<system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy  usesystemdefault="False" proxyaddress ="http://172.16.12.12:8080" bypassonlocal ="True" />
    </defaultProxy>
</system.net>

Beneath the fundamental <configuration> elements in app.config or Web.config:

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

如果你想具体说明代用细节,请说明这一点。

<?xml version="1.0" encoding="utf-8" ?>
     <configuration>
          <system.net>
              <defaultProxy enabled="true" useDefaultCredentials="true">
                <proxy proxyaddress="http://<ProxyServer>:<port>" 
                       usesystemdefault="False" 
                       bypassonlocal="True" 
                       autoDetect="False" />
              </defaultProxy>
          </system.net>
</configuration>

Cheers!

We spent a long time struggling with this issue and updated our app.config to use default credentials as specified in the answers above. However, it still didn t work! Following a lot of pain we discovered that our app.config was not being included automatically with our click once application. Simple mistake caused extreme head wreckedness!!!





相关问题
热门标签