BasicHttpBinding.BypassProxyOnLocal BasicHttpBinding.BypassProxyOnLocal BasicHttpBinding.BypassProxyOnLocal BasicHttpBinding.BypassProxyOnLocal Property

定义

获取或设置一个值,该值指示是否对本地地址不使用代理服务器。Gets or sets a value that indicates whether to bypass the proxy server for local addresses.

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;否则为 falsetrue to bypass the proxy server for local addresses; otherwise, false. 默认值为 falseThe default value is false.

示例

下面的示例设置此属性以指示应对本地资源不使用代理。The following example sets this property to indicate that the proxy should be bypassed for local resources.

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

也可以在配置文件中设置此属性的值。The value of this property can also be set in the configuration file.

<configuration>
  <system.serviceModel>

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

</configuration>

注解

如果 Internet 资源具有本地地址,则该资源是本地资源。An Internet resource is local if it has a local address. 本地地址是指位于同一台计算机、 本地 LAN 或 intranet 上,在语法上标识,通过省略句点 (.) 如下所示 Urihttp://webserver/http://localhost/A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs http://webserver/ and http://localhost/.

设置 BypassProxyOnLocal 属性确定终结点是否配置了BasicHttpBinding访问本地资源时使用代理服务器。Setting the BypassProxyOnLocal property determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources.

如果 BypassProxyOnLocal true,对本地 Internet 资源请求不使用代理服务器。If BypassProxyOnLocal is true, requests to local Internet resources do not use the proxy server. 当此属性设置为 localhost 时,如果希望客户端在与同一台计算机上的服务通信时使用代理,请使用主机名(而非 true)。Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this property is set to true.

BypassProxyOnLocal 时false,所有 Internet 请求对非 localhost 的 Uri 都通过代理服务器。When BypassProxyOnLocal is false, all Internet requests to non-localhost URIs are made through the proxy server. 对 Uri 使用 localhost 的请求将不使用代理服务器而不考虑 BypassProxyOnLocal 设置。Requests to URIs with localhost will not use the proxy server regardless of the BypassProxyOnLocal setting.

适用于