asp.net远程调用WebService的两种方法(转载)

一,静态方法
在“解决方案‘项目名’” -> 相应的文件夹,如“Web 
References” ->右键“添加WEB引用”->在URL里写入地址。
二,动态方法
在“解决方案‘项目名’” -> 
相应的文件夹,如“Web 
References” ->右键“添加WEB引用”这里改成动态。
这样在web.config文件就会自动加上一条。如:
<add 
key="Ent.EntInfo.GetCorpInfo" 
value="http://192.20.0.135/WebService/GetCorpInfo.asmx"/></appSettings>
程序中:
lv.Url 

System.Configuration.ConfigurationSettings.AppSettings["Ent.EntInfo.GetCorpInfo"];
如此调用就可以了。这样每次修改,只要修改web.config里文件就行了

原文地址:https://www.cnblogs.com/shangshen/p/3450632.html