Change service reference URL in code

独自空忆成欢 提交于 2020-01-21 10:48:25

问题


I'm working in a Windows Phone 8 project and in order to use some webservices I added a service reference with a specific URL.

My problem is the URL because it changes fom time to time so I need to let the user insert the new URL from some menu when the app is running.

I know how to change it in Visual Studio but now I need to change it in code when the app is running..so my question is: how do I change the URL in code?

I have done some search and the file "app.config" seems to do the job but I don't have any "app.config" in my project and from what I saw Windows Phone projects don't use such file.


回答1:


Simply change the endpoint address, e.g.

clientProxy.Endpoint.Address = new EndpointAddress(yourUri);


来源:https://stackoverflow.com/questions/17791690/change-service-reference-url-in-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!