The WCF Routing Service comes with a nice set of configuration for defining the client endpoints and the filters to map them for a single request.
You can define filters, be that on the message headers or content (using XPath) in order to select the appropriate endpoint to the back-end service.
I was looking for a way to determine this in runtime. The router facade I built uses information from the service registry to select the endpoint information for communicating with the back-end service.
This means that I can’t follow the standard way of defining this in configuration since this information is dynamic and resolved in runtime.
I didn’t find a way to plug-in my own behavior to affect the routing service endpoint selection in the manner of an extensibility point for returning an actual service endpoint from the current context.
That’s a shame but there’s still a different way to do that.
WCF 4 samples include a sample showing how to reconfigure the routing in runtime.
In general, the way to go about it is reconfiguring the routing behavior whenever needed, you may want to look into implementing your own custom message filter as well.
To summarize this post, although the routing service isn’t built in a very extensible manner, resolving endpoint information in runtime is still possible.