Dynamic Endpoint Discovery for WCF 4.0
In a disaster and recovery scenario, the machine that hosts your essential services may crash or otherwise become unavailable. While a hot failover may be available, that often requires either broadcasting an updated DNS entry or a pre-configured load balancer. But what if it didn’t have to be that way? What if client applications could simple ask “Who supports contract IFoo?” and automatically resolve address and binding information.
With WCF 4.0’s dynamic endpoint discovery features, that becomes possible. Based on the WS-Discovery standard, services can now use the “udpDiscoveryEndpoint” to broadcast the existence. Applications can then use the DiscoveryClient API to find services that implement a given contract.
Once the address is found, you still need the binding information before you can start making calls to the service. This can be done with the MetadataResolver, an API that has been around since the beginning of WCF. Like endpoint discovery, this is based on a Web Services standard, specifically WS-MetadataExchange.
Building on top of this is the AnnouncementService. This allows clients to be notified when a service goes online or offline. Combined with dynamic discovery, sophisticated load balancing and failover designs can be developed.
Todd Montgomery Dec 19, 2014