Thursday, July 30, 2009

Silverlight With WCF Service

How to use a WCF Service from a silverlight client?Let us discuss how we can achieve that.Sample application is also attached in the bottom of this article.
    • Open Visual Studio and Create a new Silverlight application by selecting any of the available project templates in visual studio.Here i am selecting Silverlight Navigation Application,
This will create a silverlight project and a Web project in the solution.
    • Right Click the solution and Add a New WCF Service Application,
    • Create service methods in the WCF Service Application.
    • Add Service Reference to the Silverlight application by right clicking it and select Add Service Reference.
    • Add crossdomain.xml file to the WCF Service Project for enabling silverlight application to access the WCF Service.If WCF service is hosted in a web application then add policy file to the web application.
    • Try to access the service methods in silverlight application using the service reference added.
    • Download Silverlight & WCF Service Sample Application.If you get any run time errors for the sample application then delete and add the service reference again in the silverlight project.

Another sample application - A Silverlight RSS Reader


Anonymous said...

Grate Post.Thank you - thanks From Sri Lanka

Post a Comment