BasicHttpBinding.HostNameComparisonMode BasicHttpBinding.HostNameComparisonMode BasicHttpBinding.HostNameComparisonMode BasicHttpBinding.HostNameComparisonMode Property

定义

获取或设置一个值,该值指示在对 URI 进行匹配时,是否使用主机名来访问服务。Gets or sets a value that indicates whether the hostname is used to reach the service when matching the URI.

public:
 property System::ServiceModel::HostNameComparisonMode HostNameComparisonMode { System::ServiceModel::HostNameComparisonMode get(); void set(System::ServiceModel::HostNameComparisonMode value); };
public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get; set; }
member this.HostNameComparisonMode : System.ServiceModel.HostNameComparisonMode with get, set
Public Property HostNameComparisonMode As HostNameComparisonMode

属性值

一个 HostNameComparisonMode 值,该值指示在对 URI 进行匹配时,是否使用主机名来访问服务。The HostNameComparisonMode value that indicates whether the hostname is used to reach the service when matching on the URI. 默认值为 StrongWildcard,表示忽略匹配项中的主机名。The default value is StrongWildcard, which ignores the hostname in the match.

示例

下面的示例设置此属性,以便指示需要精确匹配。The following example sets this property to indicate that an exact match is required.

BasicHttpBinding binding = new BasicHttpBinding();
binding.HostNameComparisonMode = HostNameComparisonMode.Exact;

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

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
                 hostNameComparisonMode ="Exact">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>

</configuration>

适用于