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

Service Bus Discovery

The benefits of dynamic addresses and decoupling clients and services on the address axis apply just as well to services that rely on the service bus to receive client calls. The problem is that UDP-based discovery is purely an intranet facility—there is no way to broadcast address information across the Internet. This means services that use the service bus cannot use WCF discovery.

However, you can use the events relay binding to substitute UDP multicast requests to provide discovery and announcements. This allows you to combine the benefits of ease of deployment of discoverable services with the unhindered connectivity of the service bus. The rest of this appendix walks through a small framework I wrote to support discovery over the service bus, bringing it on par with the built-in support for discovery in WCF, along with my set of helper classes. It also serves as an example for rolling out your own discovery mechanism.

Solution Architecture

For the built-in discovery of WCF, there are standard contracts for the discovery exchange. Sadly, these contracts are defined as internal. The first step in a custom discovery mechanism is to define the contracts for discovery request and callbacks. I defined the IServiceBusDiscovery contract:

[ServiceContract]
public interface IServiceBusDiscovery
{
   [OperationContract(IsOneWay = true)]
   void OnDiscoveryRequest(string contractName,string contractNamespace,
                           Uri[] scopesToMatch,Uri responseAddress);
}

The discovery endpoint ...

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