<serviceDiscovery>

指定服务终结点的可发现性。

架构层次结构

<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <serviceBehaviors> 的 <behavior>
        <serviceDiscovery>

语法

<behaviors>  <serviceBehaviors>    <behavior name=String">      <serviceDiscovery>        <announcementEndpoints>              <endpoint name="String”                        kind="Type" />        </announcementEndpoints>        <discoveryEndpoints>              <endpoint name="String”                        kind="Type" />        </discoveryEndpoints>      </serviceDiscovery>    </behavior>  </serviceBehaviors></behaviors>

属性和元素

以下几节描述了特性、子元素和父元素。

属性

无。

子元素

元素 说明

<announcementEndpoint>

一个公告终结点集合。使用此节可指定用于发送公告消息的终结点。

<discoveryEndpoint>

一个发现终结点集合。使用此节可指定要在其上侦听发现消息的终结点。

父元素

元素 说明

<endpointBehaviors> 的 <behavior>

指定行为元素。

备注

将此配置元素添加到服务的行为配置后,此元素可使系统检测到此服务的所有终结点。通过使用 <discoveryEndpoint><announcementEndpoint> 或 子元素,您可以进一步配置此类终结点的发现功能。使用 <announcementEndpoint> 节可以通过指定用于发送服务公告(联机/Hello 和脱机/Bye)的终结点配置来配置公告。使用 <discoveryEndpoint> 节可以手动指定要在其上侦听发现消息的终结点。

示例

下面的配置示例指定 CalculatorService 可供检测,并选择指定要使用的公告终结点。

<services>
  <service name="CalculatorService"
           behaviorConfiguration="CalculatorServiceBehavior">
  ...
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="CalculatorServiceBehavior">
      <serviceDiscovery>
        <announcementEndpoints>
              <endpoint name="udpEndpoint"
                        kind="udpAnnouncementEndpoint" />
        </announcementEndpoints>
      </serviceDiscovery>
    </behavior>
  </serviceBehaviors>
</behaviors>

另请参见

参考

ServiceDiscoveryBehavior