【发布时间】:2014-06-04 04:55:40
【问题描述】:
我遇到了麻烦...我正在从我的 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 策略文件”。我搜索了很多,但没有任何效果。我已阅读 Security Sandbox of the Webplayer 但无法找到解决方案。我在Edit/Project Setting/Editor 中添加了Host URL 作为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;
}
【问题讨论】:
标签: visual-studio-2012 unity3d web-deployment wcf-security unity-web-player