BasicHttpBinding.BypassProxyOnLocal 屬性

定義

取得或設定值,這個值表示是否略過 Proxy 伺服器而改用本機位址。

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 表示略過 Proxy 伺服器而改用本機位址,否則為 false。 預設值是 false

範例

下列範例會將這個屬性設為表示應略過本機資源的 Proxy。

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>

備註

如果網際網路資源有本機位址,則此資源為本機資源。 本機位址是位於同一部電腦、本機 LAN 或內部網路,而且在語法上,因為 URI http://webserver/http://localhost/ 中缺少期間 (.) 。

設定 BypassProxyOnLocal 屬性會決定存取本機資源時,是否使用 BasicHttpBinding Proxy 伺服器設定的端點。

如果 BypassProxyOnLocal 為 true ,則對本機網際網路資源的要求不會使用 Proxy 伺服器。 當這個屬性設定為 localhost 時,如果想要讓用戶端在與相同電腦上的服務進行交談時通過 Proxy,請使用主機名稱 (而非 true)。

當 BypassProxyOnLocal 為 false 時,所有對非 localhost URI 的網際網路要求都會透過 Proxy 伺服器進行。 不論 BypassProxyOnLocal 設定為何,具有 localhost 的 URI 要求都不會使用 Proxy 伺服器。

適用於