How can I dynamically switch web service addresses in .NET without a recompile?

后端 未结 11 970
小蘑菇
小蘑菇 2020-11-28 09:11

I have code that references a web service, and I\'d like the address of that web service to be dynamic (read from a database, config file, etc.) so that it is easily changed

11条回答
  •  醉酒成梦
    2020-11-28 09:40

    If you are fetching the URL from a database you can manually assign it to the web service proxy class URL property. This should be done before calling the web method.

    If you would like to use the config file, you can set the proxy classes URL behavior to dynamic.

提交回复
热议问题