问题
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