HttpWebClientProtocol.Proxy 屬性

定義

取得或設定 Proxy 資訊,以製作穿越防火牆的 XML Web Service 要求。

C#
[System.ComponentModel.Browsable(false)]
public System.Net.IWebProxy Proxy { get; set; }

屬性值

IWebProxy,包含用於產生穿越防火牆之要求的 Proxy 資訊。 預設值是作業系統 Proxy 設定。

屬性

範例

下列範例會先設定下列 Proxy 設定,再 Math 叫用 XML Web 服務:Proxy 伺服器至 http://proxyserver 、Proxy 埠設為 80,以及略過本機位址的 Proxy 伺服器。

C#
MyMath.Math math = new MyMath.Math();

// Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server
// for local addresses.
IWebProxy proxyObject = new WebProxy("http://proxyserver:80", true);
math.Proxy = proxyObject;

// Call the Add XML Web service method.
int total = math.Add(8, 5);

備註

Proxy如果用戶端需要使用與系統設定中的 Proxy 設定不同的 Proxy 設定,請使用 屬性。 使用 類別 WebProxy 來設定 Proxy 設定,因為它會實作 IWebProxy

您可以在組態檔中設定預設 Proxy 設定。 如需詳細資訊,請參閱 設定網際網路應用程式

適用於

產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另請參閱