Apologies if this has been asked before (I couldn't find the answer anywhere), but I have a WCF Service Application that I have created, and am trying to access via my Silverlight 4 app. I have added the service reference to the SilverLight App and am just trying to call one of the default pre existing methods on the service (GetData). When calling the method i get an error of:
An error occurred while trying to make
a request to URI "my URI" This could
be due to attempting to access a
service in a cross-domain way without
a proper cross-domain policy in place,
or a policy file that is unsuitable
for SOAP Services.
I'm aware I need a crossdomain.xml file, but it doesnt seem to matter where i place the crossdomain.xml file, i still get the error, this is the contents of the file:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*"/>
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Any ideas?
Best Answer
It does matter where you place the policy file - it needs to be placed "at the root" of the web server that's running your service.
That's pretty well documented up at http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx
My best advice on these issues is to run the Fiddler tool and trace the traffic and you should see Silverlight looking for a clientaccesspolicy.xml file (and also the crossdomain.xml file which is a different format) and that should make it easier to determine where Silverlight is looking for the file.
Mike.