[Note: all the information was gathered based on a close-to-Beta 1 build of .NET Framework 4.0 and Visual Studio 2010. Details may vary and change]
As indicated in my post about discovery features there is a new feature in WCF4 called standard endpoints. The purpose of standard endpoints in WCF config is to allow for reusable pre-configured endpoints.
We all know that endpoints in WCF have many moving parts (address, binding, contract, behaviors). In some cases some of these parts are constrained. This is most common with infrastructure or system endpoints where the contract is fixed and provided externally to the service. Examples include MEX, discovery, WF instance control endpoints, etc.
To specify a standard endpoint we configure a normal endpoint and then specify its "kind" attribute:
<system.serviceModel>
<services>
<service name="HelloService">
<endpoint kind="udpDiscoveryEndpoint" />
</service>
</services>
<behaviors>
<behavior>
<serviceDiscovery />
</behavior>
</behaviors>
</system.serviceModel>
These are the pre-defined standard endpoints (screenshot from Visual Studio's XML Schema explorer):
We can also optionally specify a reusable endpointConfiguration for the endpoint using the new standardEndpoints section in config. This is similar to how one would specify a bindingConfiguration for a binding:
<system.serviceModel>
<services>
<service name="HelloService">
<endpoint
kind="udpDiscoveryEndpoint"
endpointConfiguration="udpDiscoveryEndpointSettings"/>
</service>
</services>
<standardEndpoints>
<udpDiscoveryEndpoint>
<standardEndpoint
name="udpDiscoveryEndpointSettings"
multicastAddress="soap.udp://239.255.255.252:3704"
maxResponseDelay="00:00:02">
<transportSettings
duplicateMessageHistoryLength="2048"
maxPendingMessageCount="5"
maxReceivedMessageSize="8192"
maxBufferPoolSize="262144"/>
</standardEndpoint>
</udpDiscoveryEndpoint>
</standardEndpoints>
<behaviors>
<behavior>
<serviceDiscovery />
</behavior>
</behaviors>
</system.serviceModel>
Not a very big but surely a convenient addition to WCF's feature set.
That's it for now for a first look into standard endpoints in WCF4.
Stay tuned for more.
Comments