O'Reilly logo

Programming WCF Services, 3rd Edition by Juval Lowy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Address Discovery

Discovery relies on UDP (User Datagram Protocol). Unlike TCP, UDP is a connectionless protocol, and no direct connection is required between the packet’s sender and the receiver. The client uses UDP to broadcast discovery requests for any endpoint supporting a specified contract type. Dedicated UDP discovery endpoints that the services support will receive these requests (WCF offers a standard implementation of the discovery endpoint). The implementation of the discovery endpoint, in turn, responds back to the client with the address of the service endpoints that support the specified contract. Once the client discovers the services, it continues to invoke them as with regular WCF calls. This sequence is illustrated in Figure C-1.

Address discovery over UDP

Figure C-1. Address discovery over UDP

Note

Since discovery is predicated on the service responding to the client request, the service process must be running before the client issues the request. This mandates the use of self-hosting or Windows Server AppFabric with Auto-start enabled.

Service Configuration

To receive the discovery request, the service must support a discovery endpoint. Much like the MEX endpoint, WCF offers a standard discovery endpoint with the type UdpDiscoveryEndpoint:

public class DiscoveryEndpoint : ServiceEndpoint
{...}
public class UdpDiscoveryEndpoint : DiscoveryEndpoint
{...}

The service can have the host implement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required