views:

106

answers:

1
+2  Q: 

CrossDomain error

Hi,

I have hosted my Silverlight application in IIS, now when I try to access the application I get the following error

System.ServiceModel.CommunicationException: an error occured while trying to make request to URI This could be due to attempting to access a service in a cross-domain way without proper cross-domain policy in place, or policy that is unsuitable for SOAP services.....

I have placed the cross-domain policy properly in wwwroot as well as in the virtual directory.

<?xml version="1.0"?>

<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

Please help!

Thanks

A: 

If you don't need to be Flash-compatible with the security policy, try using the Silverlight-specific clientaccesspolicy.xml and see if you get the same error. Check out Tim Heuer's blog post about troubleshooting file location errors if you still are having issues

<?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 include-subpaths="true" path="/" />
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
Tim Trout
I did that, same problem!I used Silverlight Spy and the problem seems to be in cross domain file.Tell me where are they supposed to be placed? I placed in wwwroot folder. Actually I had done the same thing in local IIS and every thing worked perfect, when I moved it to my server, it is throwing this error!
James
The policy file is for granting access to any web services your SL client needs, so the file needs to go in the root web directory of the web services.
Tim Trout
I have placed it there! can't seem to get hold of the error. It had worked perfectly alrite in local IIS.
James
I added a link in my answer to a Tim Heuer blog post about troubleshooting this problem. Check out his recommendations and see if they fit your scenario.
Tim Trout
I checked that, everything seems to be the way its mentioned. I am getting a HTTP 200 for both the xml's!
James
Hi I think my Silverlight code is pretty alrigt, the Security exception is due to the WCF service it seems. Can you help me n this case?
James
Yes, the 200 means both xml file are being found correctly, but you are still being denied. Delete all crossdomain.xml files so only the clientaccesspolicy.xml file is present. I don't know much about the crossdomain schema, but I know the clientaccesspolicy file contents above have worked for me for an unrestricted access.
Tim Trout