Silverlight Web.Config Setting for Web Service Reference URL?
I have a Silverlight control that is hosted within an ASP.NET application. The Silverlight control has a web service reference. The URL of this service is going to vary when we install the application for our customers. I need a way to be able to change this web service 开发者_运维百科reference URL from within the web.config of the ASP.NET application. How can I do this?
You could do something like http://dev/foo/bar.svc where dev is an entry in your hosts file which will resolve to where the service resides.
If you are using Silverlight 4 you can use urls relative to the page the silverlight app is hosted on. So in ServiceReferences.ClientConfig you can change your endpoint addresses to be relative, say from http://localhost/foo/bar.svc
to /foo/bar.svc
.
精彩评论