Question

I'm in having a trouble ... I'm calling a service from my unity3D game, but it says no crossdomain.xml policy file found. for the time being I'm using LOCALHOST as http://localhost:3537/Service1.svc/search?q=newquery and I've place crossdomain.xml in the root folder of server i.e. I can get contents of that file by http://localhost:3537/crossdomain.xml file contains

<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

and when I call the service I use InspectElement/Network (in Chrome), here I can see request is send to http://localhost:3537/crossdomain.xml and response is received i.e. contents of xml file but still it says after response "Rejected because no crossdomain.xml policy file found". I've search a lot but nothing is going to work. I've read Security Sandbox of the Webplayer but unable to find solution. I've added Host URL in Edit/Project Setting/Editor as http://localhost:3537 then it work fine in unity3D, but if I build it and run ... Same ERROR ... kindly help me, I've less time as I've to submit my Project. This is my code

WWW url = new WWW("http://localhost:3537/Service1.svc/search?q=newquery");
yield return url;
if(url.error == null)
{
    str = "WWW Ok!: " + url.text;
} 
else {
    str = "WWW Error: " + url.error;
} 
Was it helpful?

Solution

Finally I've overcome this issue, after a long struggle, by just saving the crossdomain.xml in ANSI (8 bits) encoding scheme which is similar to ASCII (7 bits), I've used notepad for this purpose. like following

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top