Partager via


<hosts> Element

Specifies which clients are allowed or denied access to a Web service.

<microsoft.web.services3> Element
  <messaging> Element
    <transports> Element
      <add> Element for <transports>

<hosts default="allow|deny">
  <allow value />
  <deny value />
</hosts>

Attributes and Elements

Attributes

Attribute Description

default

Specifies whether clients are allowed or denied, by default, permission to access a Web service. The default value is allow.

Child Elements

Element Description

<allow> Element

Optional element. A list of host names, IP addresses, and/or IP address masks that are explicitly granted permission to access a Web service. The keyword all specifies that all clients are allowed access to a Web service.

<deny> Element

Optional element. A list of host names, IP addresses, and/or IP address masks that are explicitly denied permission to access a Web service. The keyword all specifies that all clients are denied access to a Web service.

Parent Elements

Element Description

<add> Element for <transports>

Adds a SOAP transport to the system.

Remarks

Use the <hosts> element to specify which clients are allowed or denied access to a Web service. By default, all clients are allowed access. WSE uses the following rules to determine whether a client is allowed or denied access. If the value of the default attribute of the <hosts> element is set to allow, then all clients are allowed access unless there is a listing in the <deny> element that is not overridden by a listing in the <allow> element. If the value of the default attribute of the <hosts> element is set to deny, then all clients are denied unless there is a listing in the <allow> element that is not overridden by a listing in the <deny> element. In either case, if the result is that the client should be denied access, then the incoming connection is immediately closed and no data is processed from it.

Before adding the <hosts> element to a configuration file, you must add the microsoft.web.services3 configuration section handler to the configuration file. For details about adding the microsoft.web.services3 configuration section handler, see <section> Element.

Example

The following code example specifies that all hosts are allowed access to a Web service except those with IP addresses starting with 192.168.1 and 10.10.100 with the exception of 192.168.1.1.

<configuration>
  <microsoft.web.services3>
    <messaging>
      <transports>
        <add scheme="soap.tcp">
          <hosts default="allow">
            <allow>192.168.1.1</allow>
            <deny>192.168.1.0/24 10.10.100.0/24</deny>
          </hosts>
        </add>
      </transports>
    </messaging>
  </microsoft.web.services3>
</configuration>

See Also

Reference

<allow> Element
<deny> Element
<transports> Element
<add> Element for <transports>