BasicHttpBinding.ProxyAddress 屬性

定義

取得或設定 HTTP Proxy 的 URI 位址。

public:
 property Uri ^ ProxyAddress { Uri ^ get(); void set(Uri ^ value); };
public Uri ProxyAddress { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.UriTypeConverter))]
public Uri ProxyAddress { get; set; }
member this.ProxyAddress : Uri with get, set
[<System.ComponentModel.TypeConverter(typeof(System.UriTypeConverter))>]
member this.ProxyAddress : Uri with get, set
Public Property ProxyAddress As Uri

屬性值

Uri

當做 HTTP Proxy 之位址使用的 Uri。 預設值為 null。

屬性

範例

下列範例會將 ProxyAddress 設為應用程式設定。

// Get base address from app settings in configuration
Uri baseAddress = new Uri(ConfigurationManager.AppSettings["baseAddress"]);

BasicHttpBinding binding = new BasicHttpBinding();

binding.ProxyAddress = baseAddress;

這個屬性的值也可以在組態檔中設定。

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
                 proxyAddress = "http://myProxy">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>

</configuration>

備註

UseDefaultWebProxy如果 設定為 true ,則會使用預設位址,並忽略 ProxyAddress 集合的值。

適用於