WCF cross-domain policy security error
I am using VSTS 2008 + C # + WCF + .Net 3.5 + Silverlight 3.0. I am hosting a Silverlight control in a html page and debugging it with VSTS 2008 (press F5 then start the ASP.Net Embedded Development Web Server in VSTS 2008) then call another WCF service (hosted on another machine with IIS 7.0 + Vista) The WCF service is very simple, just return a constant string to the client.
When calling a WCF service from Silverlight, I got the following error message:
An error occurred while trying to make a request for the URI ' https: //LabTest/Test.svc '. This could be due to an attempt to access the service in cross-domain mode without a proper cross-domain hosting policy or a policy that is unusable for SOAP services. You may need to contact the service owner to publish the cross-domain policy file and ensure that it sends the SOAP-related HTTP headers. This error can also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute. See Inner Exception for details.
Here is the clientaccesspolicy.xml file, is there something wrong?
<access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="*"> </domain> </allow-from> <grant-to> <resource path="/" include-subpaths="true"></resource> </grant-to> </policy> </cross-domain-access> </access-policy>
source to share
It could be an escape in the dark. But I remember how a similar scenario works, installing WCF service locally on Vista and IIS7. as it turned out I had to add some lines to my web.config file, specifically using baseAddressPrefixFilters, read this other post: here . I had a problem because my default site had more than one host binding. this will require *: 80 and www.mydomain.com:80 and WCF won't like that.
one idea might be to use a fiddler and search for a query asking for a crossdomainpolicy xml. Is this a failure? Check the address it points to. I was debugging my problem using this. It was pointing to the server root and my crossdomainpolicy xml was in the WCF project folder.
source to share