Flex:连接到 WebSocket 时出现错误 #2048
我已经实现了一个简单的 Flex 应用程序,它尝试通过 WebSocket 协议连接到服务器。在 Flash Builder 4.6 调试器中运行应用程序一切正常。所以我在我的服务器上安装了该应用程序,过了一会儿我收到错误#2048。 #2048 似乎是一个有关安全的错误。
服务器提供了这个 crossdomain.xml:
更新
<?xml version="1.0" encoding="UTF-8" ?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
编辑: 它是通过调用提供的,
Security.loadPolicyFile('http://myserver:8081/crossdomain.xml');
我可以在客户端加载它的网络服务器日志中看到。
我使用 AS3WebSocket 作为 Flex 的 WebSocket 实现。
这是我设置 WebSocket 对象的方式:
websocket = new WebSocket(url, "*", 'dummy', 5000);
// adding several event handler ...
websocket.connect();
连接到服务器
http://myserver:8081
浏览器使用url 参数
ws://myserver:8081/data
为什么它在 Flash Builder 本地工作而不是在我的服务器上工作?我缺少什么?
I've implemented a simple Flex application that tries to connect to a server via the WebSocket protocol. Running the app in the Flash Builder 4.6 debugger everything works fine. So I installed the application on my server and now I get Error #2048 after a while. #2048 seems to be an error concerning security.
The server provides this crossdomain.xml:
Updated
<?xml version="1.0" encoding="UTF-8" ?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
Edit: It's provided by calling
Security.loadPolicyFile('http://myserver:8081/crossdomain.xml');
I can see in the web server logs that the client loads it.
I'm using AS3WebSocket as the WebSocket implementation for Flex.
This is how I set up the WebSocket object:
websocket = new WebSocket(url, "*", 'dummy', 5000);
// adding several event handler ...
websocket.connect();
The browser connects to the server with
http://myserver:8081
The url parameter holds
ws://myserver:8081/data
Why does it work locally with the Flash Builder and not on my server? What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
省略“permissed-cross-domain-policies=”none”位。
现在尝试一下。
当一切正常时使其更加安全。
leave out the "permitted-cross-domain-policies="none" bit.
Try that for now.
make it more secure when everything works.
请检查防火墙安全[端口的内部和外部访问],这可能是导致您的问题的原因之一。
请检查以下链接:-
http://flexhappycoding.blogspot.in
Please check Firewall Security [internal and external access to port] this can be one of the cause to your problem.
Please check below link:-
http://flexhappycoding.blogspot.in
我得到了这个工作。我不知何故错过了我需要一个特殊的 策略服务器 为套接字运行的信息端口 843 上的策略通过 TCP 提供策略文件。
I got this working. I somehow missed the information that I needed a special policy server running for socket policies on port 843 providing the policy file via TCP.