How do you dynamically switch WCF Web Service Reference URL path through config file ?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
you can´t chance endpoint url after any calling.
E.G.
in that case, you will get answer from NEWURL:
but if you will call any method before changing url, the url will be used from app.config, like next example:
Just to expand on the answer from Erin: -
HTH!
sure you can do this, have a look here: How to config clients for a wcf service?
it is absolutely normal to point to localhost in development and to change the address (url) in production in the web.config
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.
Where those url come from wherever you want
There is no dynamic switching. Each time you want to use another URL you must create new instance of service proxy (client) and pass EndpointAddress or enpoint configuration name to the constructor.