[英]HTTP status 407: Proxy authentication required Error when calling web service
在調用Web服務時,我花了兩個小時對此錯誤“HTTP狀態407:需要代理身份驗證錯誤”,我的代碼如下所示
WebProxy oWebProxy = new System.Net.WebProxy(ProxyServer, ProxyPort);
oWebProxy.Credentials = new NetworkCredential(ProxyUser,ProxyPassword,ProxyDomain);
oserv.Proxy = oWebProxy;
oserv.Credentials = new NetworkCredential(theusername, thepassword);
我已經驗證了代理地址,用戶ID密碼都是正確的,我可以通過IE在同一台PC上訪問Web服務,但是當我用VS運行代碼時,錯誤會保持彈出狀態。 我也嘗試過UserDefaultCredentials=true
,但沒有運氣。
任何的想法?
使用useDefaultCredentials="true"
在<system.net>
下的app.config / web.config中彈出<defaultProxy />
元素可能會完成這項工作。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
</configuration>
嘗試在安裝了Web服務的同一網絡上運行該應用程序
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.