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

查看:566
本文介绍了通过动态配置文件切换WCF Web服务引用URL路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

您只是想覆盖在配置到不同的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"); 

如果这些URL来自不管你想要

Where those url come from wherever you want

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

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