我遇到麻烦了...我正在从 unity3D 游戏调用服务,但它说不 crossdomain.xml 找到策略文件。目前我使用 LOCALHOST 作为 http://localhost:3537/Service1.svc/search?q=newquery 我已经安排了 crossdomain.xml 在服务器的根文件夹中,即我可以通过以下方式获取该文件的内容 http://localhost:3537/crossdomain.xml 文件包含

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

当我致电我使用的服务时 InspectElement/Network (在 Chrome 中),在这里我可以看到请求发送到 http://localhost:3537/crossdomain.xml 并收到响应,即xml 文件的内容,但响应后仍然显示“由于找不到 crossdomain.xml 策略文件而被拒绝”。我已经搜索了很多,但没有任何效果。我读了 网络播放器的安全沙箱 但无法找到解决方案。我已经添加 Host URLEdit/Project Setting/Editor 作为 http://localhost:3537 那么它在 unity3D 中工作得很好,但是如果我构建它并运行......同样的错误...请帮助我,我的时间更少,因为我必须提交我的项目。这是我的代码

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;
} 
有帮助吗?

解决方案

经过长期斗争,我终于克服了这个问题,只保存了 crossdomain.xml 在与 ASCII(7 位)类似的 ANSI(8 位)编码方案中,我使用记事本来实现此目的。喜欢关注

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top