本文介绍了在运行时设置服务 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 = "some.other.url/"; // Now you're ready to call your service method service.SomeUsefulMethod();更多推荐
在运行时设置服务 URL
发布评论