Dynamically switch WCF Web Service Reference URL path through config file

Are you just wanting to override the URL that is in the config to a different url. Say you have a test service and a live service. You can just do this.

client.Endpoint.Address = new EndpointAddress(Server.IsLiveServer() ?
    @"LiveUrl" : @"TestURl"); 

Where those url come from wherever you want

Leave a Comment