问题描述
当我调用Web服务,我得到这个错误:
远程服务器返回错误:(407)代理身份验证。
我得到的总体思路,我可以得到的代码中加入
myProxy.Credentials =的NetworkCredential(用户,密码,域);
或代码中使用的DefaultCredentials。我的问题是,在调用Web服务在生产工作没有这一点。
好像有涉及的Machine.config非代码的解决方案,但它是什么?目前,我不能去生产彩盒的machine.config文件,看看是什么样子。我试图更新我的machine.config如下,但我仍然得到407错误。
< system.net>
< defaultProxy启用=真useDefaultCredentials =真>
< bypasslist>
<清/>
< / bypasslist>
<代理proxyaddress =MYPROXY:9000
usesystemdefault =false的
bypassonlocal =真正的
AUTODETECT =FALSE/>
< / defaultProxy>
< /system.net>
只需添加这CONFIG
< system.net>
< defaultProxy useDefaultCredentials =真正的>
< / defaultProxy>
< /system.net>
I'm getting this error when I call a web service:
"The remote server returned an error: (407) Proxy Authentication Required".
I get the general idea and I can get the code to work by adding
myProxy.Credentials = NetworkCredential("user", "password", "domain");
or by using DefaultCredentials in code. My problem is that the call to the web service works in production without this.
It seems like there is a non code solution involving Machine.config, but what is it? At the moment I can't get to the production box's machine.config file to see what that looks like. I tried updating my machine.config as follows, but I still get the 407 error.
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<bypasslist>
<clear />
</bypasslist>
<proxy proxyaddress="myproxy:9000"
usesystemdefault="false"
bypassonlocal="true"
autoDetect="False" />
</defaultProxy>
</system.net>
Just add this to config
<system.net>
<defaultProxy useDefaultCredentials="true" >
</defaultProxy>
</system.net>
这篇关于远程服务器返回错误:(407)代理身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!