BasicHttpBinding.ProxyAddress BasicHttpBinding.ProxyAddress BasicHttpBinding.ProxyAddress BasicHttpBinding.ProxyAddress Property

定义

获取或设置 HTTP 代理的 URI 地址。Gets or sets the URI address of the HTTP proxy.

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

属性值

一个充当 HTTP 代理地址的 UriA Uri that serves as the address of the HTTP proxy. 默认值为 null。The default value is null.

示例

下面的示例设置 ProxyAddress 为应用程序设置。The following example sets ProxyAddress to application settings.

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

BasicHttpBinding binding = new BasicHttpBinding();

binding.ProxyAddress = baseAddress;

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

<configuration>
  <system.serviceModel>

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

  </system.serviceModel>

</configuration>

注解

如果UseDefaultWebProxy设置为true、 使用的默认地址和 ProxyAddress 集的值将被忽略。If the UseDefaultWebProxy is set to true, the default address is used and the value of the ProxyAddress set is ignored.

适用于