How does my Silverlight app finds it’s web services?
Posted by Igor Moochnick on 04/18/2008
In a simple case, your Silverlight app will be connecting to the same Web Site for the web services that hosts the app itself. So the app can take it’s Uri and replace the trailing document name with the WebService address.
Uri docUri = HtmlPage.Document.DocumentUri; Uri svcUri = new Uri(docUri, "ServiceAdress.svc");
Note that this is a simplified code that explains the idea, so, please, do not hardcode any string constants in your code – it’ll be pretty hard to reconfigure your application later. Use configuration files.