动态地改变webservice URL [英] Dyanmically change webservice URL

查看:124
本文介绍了动态地改变webservice URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在app配置文件中动态更改webservice URL



我的app配置文件有这样的

i want to change webservice URL Dynamically in app config file

my app config file have like this

<applicationSettings>
    <HPAGRUPLOADWINDOWS.Properties.Settings>
      <setting name="NREGAUPLOADWINDOWS_UPLOAD_GetXmlData" serializeAs="String">
        <value>http://192.168.1.249:8080/HPAgriWS/services/GetXmlData.GetXmlDataHttpSoap11Endpoint/</value>
      </setting>
    </HPAGRUPLOADWINDOWS.Properties.Settings>
  </applicationSettings>



如何更改?


How can i change?

推荐答案

http:// www.codeproject.com/KB/XML/wsdldynamicurl.aspx

http://www.knowdotnet.com/articles/dynamicwebserviceurls.html


pl chec k以下线程用于不同选项:



http://stackoverflow.com/questions/5036308/dynamically-switch-wcf-web-service-reference-url-path-through-config-file [ ^ ]
pl check the following thread for different options:

http://stackoverflow.com/questions/5036308/dynamically-switch-wcf-web-service-reference-url-path-through-config-file[^]


使用以下代码:



Use the below code:

Configuration configFile = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
configFile.AppSettings.Settings["value"].Value = "http://....";
configFile.Save();


这篇关于动态地改变webservice URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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