語言

BasicHttpBinding.BypassProxyOnLocal 屬性

定義

取得或設定一個值,指示是否繞過代理伺服器取得本地位址。

public:
 property bool BypassProxyOnLocal { bool get(); void set(bool value); };
public bool BypassProxyOnLocal { get; set; }
member this.BypassProxyOnLocal : bool with get, set
Public Property BypassProxyOnLocal As Boolean

屬性值

true繞過代理伺服器取得本地位址;否則,。 false 預設值為 false。

範例

以下範例將此屬性設定為表示本地資源應被繞過代理。

BasicHttpBinding binding = new BasicHttpBinding();
binding.BypassProxyOnLocal = true;

此屬性的值也可以在設定檔中設定。

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
                 bypassProxyOnLocal="true">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

</configuration>

備註

若網際網路資源擁有本地位址,則稱為本地資源。 本地位址是指位於同一台電腦、本地區域網路或內部網路上的位址,且語法上可透過缺少句號(.)來識別,如同 URI http://webserver/ 和 http://localhost/。

設定 BypassProxyOnLocal 屬性可決定端 BasicHttpBinding 點在存取本地資源時是否使用代理伺服器。

若 BypassProxyOnLocal 為 true,對本地網際網路資源的請求不會使用代理伺服器。 localhost如果你想讓客戶端在同一台機器上與服務通訊時透過代理,且此屬性設為 true。

當 BypassProxyOnLocal 為 false時,所有對非本地主機 URI 的網際網路請求皆透過代理伺服器發出。 無論 BypassProxyOnLocal 設定如何,對 localhost 的 URI 請求都不會使用代理伺服器。

適用於