在运行时设置服务 URL [英] Setting the service URL at runtime
本文介绍了在运行时设置服务 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我添加Web 参考"时,我们将 asmx 页面的地址提供给 Visual Studio.
When I am adding the "Web Reference" we are giving the address to the asmx page to visual studio.
如何在运行时设置?
推荐答案
只需在调用任何服务方法之前设置对象的 Url 属性即可:
Just set the Url property of the object before you call any of the service methods:
YourService service = new YourService();
service.Url = "http://some.other.url/";
// Now you're ready to call your service method
service.SomeUsefulMethod();
这篇关于在运行时设置服务 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文