I understand this question has been answered many times but i could not resolve it for some reason. I hope some one can solve my problem which might be straightforward for many, but i some how couldnt figure it out as I am relatively new to silverlight and web. I have tried all the possible samples available in the internet on cross domain errors but couldnt fix it. I appreciate if any once can help me on this issue i am facing.
I am accessing WCF service from Silverlight 4 client. I have Clientacccesspolicy.xml and Crossdomain.xml in the wwwroot.
I can access my file by using [http://localhost/Remoteapp.html]. But i am getting cross domain error inspite of having the Clientaccesspolicy.xml file in the root, when the application tries to make a webservice call.
In the webdevelopementhelper i can see that the clientaccesspolicy is being requested at the wcfservice port which is [http//localhost:600061/clientaccesspolicy.xml], which is where my service is located and i am getting a 502 response[Connection failed].
When I type [http://localhost/Clientaccesspolicy.xml] in the browser i can locate the file. But silverlight is requesting the policy file at a wrong location.
Every thing works properly in the design time, but when i deploy it to IIS i am getting this error.
Can any one help me how to resolve this issue? Thanks to every one in advance.
Best Answer
Step 1: check that you have a clientaccesspolicy.xml file or crossdomain.xml file on the WCF service host.
The following clientaccesspolicy.xml
A similar crossdomain.xml file would be:
if that does not work, try these steps
On the server where the silver light application is deployed , typically in the ClientBin folder of the ASP.NET application, rename the silverlight application file *.xap to *.zip
Extract the contents of the zip file
Edit the ServiceReferences.ClientConfig file
Update the end point address from localhost to the server address where the WCF service is hosted.
Save the file. Zip the contents and rename back to .xap