使用我使用向导添加的网络服务(Visual Studio 2012)(右键单击添加网络服务引用)我添加了以下网址 "http://onwww.org:8086/Plugins/Misc.onwww/Remote/NopService.svc"
我有另一个使用相同 api 的 web 服务,这些 web 服务在各个方面都相同,契约(Contract)相同。
“http://yadisrael.org:8086/Plugins/Misc.onwww/Remote/NopService.svc”
我想在执行过程中将代码中的域名更改为另一个域,我该如何更改值?
谢谢
最佳答案
您可以在配置文件中指定两个不同的端点配置,然后当您为每个不同的端点实例化服务客户端时,调用采用 the overload that accepts an endpointConfigurationName 的构造函数.或者,您可以指定一个端点配置,然后调用 the overloads that takes a remoteAddress or endpointAddress and the endpoint configuration name. 之一
关于c# - 在执行过程中更改 web 服务地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13077206/