IgorShare Thoughts and Ideas

Consulting and Training

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: