动态加载Web Service

来源:百度文库 编辑:神马文学网 时间:2024/04/27 10:07:47
动态加载Web Service
比如你已经用教科书式的方法添加了一个Web Referece,然后现在这个Web Service内容没有变,只是换了各地方。比如从localhost:8080/a.asmx换到了localhost:8090/a.asmx。如此一来你不必重新修改Web Reference只需要在使用WebMethod时
WebS.A a = new WebS.A();
a.Url="http://localhost:8090/a.asmx"
a.remoteDosth();
就可以了!
可以把Url字符串存到config里面,用的时候去取。
简单罢?