ajax status 12030,javascript

当使用 Internet Explorer 6 和 Ajax 时,可能会遇到错误代码 12030,表示连接被服务器终止。微软的知识库显示这个错误是由于客户端认为连接保持打开,而服务器认为已经关闭。服务器发送了 FIN,客户端响应 ACK,导致连接进入 CLOSE_WAIT 状态。解决方案包括:重试 Ajax 请求、在每个 Ajax 请求前发送空请求或打包 Ajax 请求以避免超时。IE7 可以更快地处理这个问题,而 IE6 则需要等待约 60 秒让操作系统栈退役连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IE6 and error code 12030

If you are running Internet Explorer 6 and using Ajax, you may get some XMLHttpRequests terminated with code 12030.

Microsoft's knowledge base at http://support.microsoft.com/kb/193625 shows that this code is

12030 ERROR_INTERNET_CONNECTION_ABORTED

The connection with the server has been terminated.

Googling turned up no help; the people encountering this don't seem to be aware of how network sockets work, so I had to actually figure it out on my own.

This happens when the client thinks a connection has been kept open, and the server thniks it is closed. The server has sent a FIN, and the client has responded to that with an ACK. Running "netstat" on the Windows client shows that the connection is in the CLOSE_WAIT state, so IE6 really ought to have realized this before trying. This is entirely the client's fault. If you wait about 60 seconds, the Windows OS stack will retire the connection.

If you need to support IE6, you have some solutions, in various degrees of ugly:

retry the ajax request in case of error code 12030

if the browser is ie, send an empty request to the server ahead of each ajax request

bundle up your ajax requests such that the time between them is ( (greater than server_timeout) AND (less than server_timeout + one minute)

IE7, fwiw, will issue a RST over the CLOSE_WAIT socket as soon as it realizes it has an outgoing connection to make. That, and the socket will only stay in that CLOSE_WAIT state for about 5 seconds anyway.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值