通过配置文件动态切换 WCF Web 服务引用 URL 路径

问题描述:

如何通过配置文件动态切换 WCF Web 服务引用 URL 路径?

How do you dynamically switch WCF Web Service Reference URL path through config file ?

您是否只想将配置中的 URL 覆盖为不同的 URL.假设您有一个测试服务和一个实时服务.你可以这样做.

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"); 

这些网址来自哪里