Cross-domain policy issue in Silverlight application

Error:
“An error occurred while trying to make a request to 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 that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.”

1. Create an xml file using notepad and save as clientaccesspolicy.xml with the following content.

<?xml version=”1.0″ encoding=”utf-8″?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers=”SOAPAction”>
        <domain uri=”*”/>
      </allow-from>
      <grant-to>
        <resource path=”/” include-subpaths=”true”/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
2. Create an xml file using notepad and save as crossdomain.xml with the following content.
<?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=”SOAPAction,Content-Type”/>
</cross-domain-policy>
3. Copy these 2 files into web site root folder for example, c:\inetpub\wwwroot. for your IIS (local system) or in root folder of website(c:\inetpub\wwwroot\controlsdemowcf)  on server (2008, 2003).
Share