Change service reference URL in code

2020-04-02 08:35发布

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条回答
别忘想泡老子
2楼-- · 2020-04-02 09:06

Simply change the endpoint address, e.g.

clientProxy.Endpoint.Address = new EndpointAddress(yourUri);
查看更多
登录 后发表回答