Monday 15 November 2010

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 that is unsuitable for SOAP services.


When you are developing a Silverlight project, you will be getting an error saying “An error occurred while trying to make a request to URI ‘XXX.svc’. 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 that is unsuitable for SOAP services.”.

The complete Error Details will be as shown in the following figure :



For information on why this error is happening, I would request you to refer the Tim Heuer, Senior Program Manger for Silverlight blog

To fix this issue, you required to add two XML file ClientAccessPolicy.xml and CrossDomain.xml in your WCF Project. The xml content would be

ClientAccessPolicy.xml:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*">
      </allow-from>
      <grant-to>
        <resource include-subpaths="true" path="/">
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>


CrossDomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

After this you can run the project, it must work properly.

0 Responses to “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 that is unsuitable for SOAP services.”

Post a Comment