cross-domain policy file error

705 Views Asked by At

I am using WCF service (Not RIA) and silverlight I am getting the following error :

An error occurred while trying to make a request to URI 'http://localhost:8732/'. 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.

I have tried adding the following to my the clientaccesspolicy.xml file and the crossdomain.xml to the root of my web project. they look like this...

<access-policy> 
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://*"/>
        <domain uri="https://*"/>
      </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>

Any ideas why I am getting this?

Thanks in advance.

3

There are 3 best solutions below

0
Vamsi On

If you can't install fiddler, can you download and use TcpTrace? http://www.pocketsoap.com/tcptrace/

0
IsolatedStorage On

The clientaccesspolicy.xml needs to be placed at the root of the website hosting your WCF service and not at the root of your web project.

0
T. Webster On

I ran into this problem with a SOAP WCF service as soon as I moved by WCF service into a separate web app from my Silverlight web app project. Even with my clientaccesspolicy.xml in the WCF web app's root, I was still getting this error. The fastest solution for me was to change my WCF service from SOAP to REST, and then finally Silverlight recognized the clientaccesspolicy.xml and the requests started working again.