問題描述
通過代理調用 WSE Web 服務 (Calling a WSE web‑service though a proxy)
我正在使用 Web Services Enhancements 3.0 從使用 Visual Studio 2005 用 C# 編寫的 ASP.NET 應用程序調用 Web 服務。
如果我可以在 Internet Explorer 中調用 Web 服務更改網絡連接設置以使用特定的 SOCKS5 代理,但從 .ASPX 頁面我收到一條錯誤消息,告訴我應該使用代理。
你知道如何配置網絡服務客戶端使用代理?
謝謝
PS:
將以下內容添加到Web.config不起作用:
<system.net>
<defaultProxy>
<proxy proxyaddress="http://theproxy:8080" bypassonlocal="True" />
</defaultProxy>
</system.net>
參考解法
方法 1:
You need to set "enabled" attribute of defaultProxy element to "true" to make it work:
<system.net>
<defaultProxy **enabled="true"**>
<proxy proxyaddress="http://theproxy:8080" bypassonlocal="True" />
</defaultProxy>
</system.net>
This should work.
(by Julio César、Mik Kardash)