I want to dynamically change the address of a WCF service called from my client based on custom information in the client's application configuration file.
My first attempt was to create an endpoint behavior, and implement the IEndpointBehavior.Validate
method, implemented something like the following:
void IEndpointBehavior.Validate(ServiceEndpoint endpoint)
{
... endpoint.Address = new EndpointAddress(...);
}
This method is called before the client attempts to connect, and appears to successfully change the endpoint address. However the WCF infrastructure appears to still attempt the connection using the original address.
Is there any way to achieve this using an endpoint behavior or some other WCF extension point?