Flash WebSocket断开连接



我使用AS3WebSocket模块连接web套接字。当我在本地启动flash 时,它工作得很好(flash文件在全局设置中被标记为可信)。

但是当我用flash打开服务器页面时,它不起作用。我没有错误信息,只是在日志中"断开"。

WinServer2012, IIS, ASP。净MVC4

日志如下:

ws init begin: ws://www.sample.biz/WsHandler.ashx?userId=5
Disconnected null[object WebSocket]

和代码:

function SYS_wsInit_begin():void
{
writeLog("ws init begin: " + ws_init_url);
trace(ws_init_url);
try
{
    websocket = new WebSocket(ws_init_url,"*");
    websocket.addEventListener(WebSocketEvent.CLOSED, handleWebSocketClosed);
    websocket.addEventListener(WebSocketEvent.OPEN, handleWebSocketOpen);
    websocket.addEventListener(WebSocketEvent.MESSAGE, handleWebSocketMessage);
    websocket.addEventListener(WebSocketErrorEvent.CONNECTION_FAIL, handleConnectionFail);
    websocket.connect();
}
catch (err:Error)
{
    writeLog("ws init failed: " + err.message + err.name);
}
}
function handleWebSocketClosed(event:WebSocketEvent):void
{
    writeLog("Disconnected " + event.message + event.target);
    trace("Disconnected");
}
function handleWebSocketOpen(event:WebSocketEvent):void
{
    writeLog("Connected");
    trace("Connected");
}
function handleConnectionFail(event:WebSocketErrorEvent):void
{
    writeLog("Connection Failure: " + event.text);
    trace("Connection Failure: " + event.text);
}

crossdomain.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*"/>
    <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

我还安装了套接字策略文件服务器,文件:

<?xml version="1.0"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
  <site-control permitted-cross-domain-policies="*" />
  <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>

我能做什么?

哦,我已经解决了这个问题。阅读后,http://forums.adobe.com/message/5297747我试着用fiddler检查843端口,但我只得到一个重定向到索引页。

我检查了IIS配置。843端口有绑定。删除绑定并重启套接字策略文件服务器后,web -套接字连接建立成功!

相关内容

  • 没有找到相关文章

最新更新