How can we do database operation using SilverLight? Contd.

 Posted by ArticlesMaint on 9/23/2009 | Category: Silverlight Interview questions | Views: 2500

Step 3:- Copy the CrossDomain.xml and ClientAccessPolicy.XML file

This WCF service is going to be called from an outside domain, so we need to enable the cross domain policy in the WCF service by creating ‘CrossDomain.xml’ and ‘ClientAccessPolicy.xml’. Below are both the code snippets. The first code snippet is for cross domain and the second for client access policy.


<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "">
<allow-http-request-headers-from domain="*" headers="*"/>


<?xml version="1.0" encoding="utf-8" ?>

<allow-from http-request-headers="*">
<domain uri="*"/>
<resource include-subpaths="true" path="/"/>

Step 4:- Change the WCF bindings to ‘basicHttpBinding’

Silverlight consumes and generates proxy for only ‘basicHttpBinding’ , so we need to change the endpoint bindings accordingly.

<endpoint address="" binding="basicHttpBinding" contract="WCFDatabaseService.IServiceCustomer">


Step 5:- Add service reference

We need to consume the service reference in silverlight application using ‘Add service reference’ menu. So right click the silverlight project and select add service reference.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response