通过配置文件动态切换 WCF Web 服务引用 URL 路径 [英] Dynamically switch WCF Web Service Reference URL path through config file

查看:22
本文介绍了通过配置文件动态切换 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"); 

这些网址来自哪里

这篇关于通过配置文件动态切换 WCF Web 服务引用 URL 路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆