IE10/IE11 在清除缓存后中止 Post Ajax 请求并显示错误“网络错误 0x2ef3”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16312938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 11:00:40  来源:igfitidea点击:

IE10/IE11 Abort Post Ajax Request After Clearing Cache with error "Network Error 0x2ef3"

javascriptajaxpostxmlhttprequestinternet-explorer-10

提问by Laith Shadeed

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3 无法完成操作

No valid solution at the moment.

目前没有有效的解决方案。

Update: Noticed on IE11 also.

更新:也在 IE11 上注意到。

After more and more investigation, I come with this results:

经过越来越多的调查,我得出了这样的结果:

  1. The problem is specific to my application, it does not happen on facebook.
  2. The problem has nothing to do with max number of requests per host (I did sample page that flood the server, IE10 is able to handle up to 8-10 req at the same time, inside my application I also tried to do ajax requests serially, it failed also).
  3. The problem is specific to POST requests.
  4. The problem is not specific to the JS library used (I tried direct XMLHttpRequest from console it also failed).
  5. The failure happened after xhr.send(), xhr.readyState = 4 and xhr.onreadystatechange triggered.
  6. The failure is not related to any Content-type, proper requests or server configuration. It is only client, requesting dummy page will fail, with a bare minimum XHR, just xhr.open and xhr.send.
  7. It happened mainly after clearing browser cache.
  8. Doing GET request before POST does not solve this problem.
  1. 该问题特定于我的应用程序,它不会发生在 facebook 上。
  2. 该问题与每台主机的最大请求数无关(我做了使服务器泛滥的示例页面,IE10 能够同时处理多达 8-10 个请求,在我的应用程序中,我还尝试串行执行 ajax 请求,它也失败了)。
  3. 该问题特定于 POST 请求。
  4. 问题并非特定于所使用的 JS 库(我尝试从控制台直接使用 XMLHttpRequest,但它也失败了)。
  5. 失败发生在 xhr.send()、xhr.readyState = 4 和 xhr.onreadystatechange 触发之后。
  6. 失败与任何内容类型、正确的请求或服务器配置无关。它只是客户端,请求虚拟页面将失败,只有最低限度的 XHR,只有 xhr.open 和 xhr.send。
  7. 它主要发生在清除浏览器缓存之后。
  8. 在 POST 之前做 GET 请求并不能解决这个问题。

My questions are:

我的问题是:

  1. How browser cache may affect POST ajax requests?
  2. Does any body have contact with IE developers to tell us what this error 'Network Error 0x2ef3' mapped to ?
  1. 浏览器缓存如何影响 POST ajax 请求?
  2. 是否有任何机构与 IE 开发人员联系以告诉我们此错误“网络错误 0x2ef3”映射到什么?

For now the temporary solution I am doing is simply retry for a max 3 times if the HTTP status code was zero. But it is very ugly because even upload requests sometimes failed, and it become slow for those requests with retry, sometimes it will take extra 100ms.

现在我正在做的临时解决方案是如果 HTTP 状态代码为零,则最多重试 3 次。但它非常难看,因为即使上传请求有时也会失败,并且重试的那些请求会变慢,有时会额外花费 100 毫秒。

Steps to reproduce:

重现步骤:

  1. Make sure fiddler or proxy is disabled.
  2. http://ie10.laiths.name/#!login
  3. Open IE10 console, delete your browser cache.
  4. Try this invalid login: [email protected]/random
  5. After 3-4 times (clear-cache/invalid-login) you will see this error: SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3.
  1. 确保 fiddler 或代理被禁用。
  2. http://ie10.laiths.name/#!login
  3. 打开IE10控制台,删除浏览器缓存。
  4. 试试这个无效的登录:[email protected]/random
  5. 3-4 次(清除缓存/无效登录)后,您将看到此错误:SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3 无法完成操作。

My IE Version:

我的IE版本:

  • Win7 IE10 Version: 10.0.9200.16618
  • Update Version: 10.0.6 (KB2838727)
  • Win7 IE10 版本:10.0.9200.16618
  • 更新版本:10.0.6 (KB2838727)

For now I am solving it by retrying a max of 3 times if the browser is IE10&& Request is POST&& HTTP status code is 0.

现在,如果browser is IE10&& Request is POST&& ,我通过最多重试 3 次来解决它HTTP status code is 0

I would appreciate if somebody can help me to remove my ugly solution, because with such solution even if the the request goes to the server and it returns 0 I will also retry (I was trying to avoid that by measuring the time between xhr.send and its callback but it is not reliable), what about if IE10 in comptMode, what about if IE11 has same problem, add to that performance, it will take on my machine ~170ms between each retry.

如果有人可以帮助我删除我丑陋的解决方案,我将不胜感激,因为使用这样的解决方案,即使请求发送到服务器并返回 0,我也会重试(我试图通过测量 xhr.send 之间的时间来避免这种情况)和它的回调,但它不可靠),如果 IE10 处于 comptMode 怎么办,如果 IE11 有同样的问题怎么办,增加该性能,每次重试之间它会占用我的机器 ~170 毫秒。

回答by Ezequiel Gorbatik

This can be happening due a security certificate issue. If you clear the cache you loose part (if not all) of certificate information.

这可能是由于安全证书问题而发生的。如果清除缓存,则会丢失部分(如果不是全部)证书信息。

You can find more information (and a workaround) in http://www.jonnyreeves.co.uk/2013/making-xhr-request-to-https-domains-with-winjs/

您可以在http://www.jonnyreeves.co.uk/2013/making-xhr-request-to-https-domains-with-winjs/ 中找到更多信息(和解决方法)

Basically it says you must do a GET before your POST request in order to update the certificate information.

基本上它说您必须在 POST 请求之前执行 GET 以更新证书信息。

回答by Andrew Keeling

I had this problem, an AJAX Post request that returned some JSON would fail, eventually returning abort, with the:

我遇到了这个问题,返回一些 JSON 的 AJAX Post 请求将失败,最终返回 abort,并显示:

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3

SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3

error in the console. On other browsers (Chrome, Firefox, Safari) the exact same AJAX request was fine.

控制台中的错误。在其他浏览器(Chrome、Firefox、Safari)上,完全相同的 AJAX 请求没问题。

Further investigation revealed that the response was missing the status code - in this case it should have been 500 internal error.

进一步调查显示响应缺少状态代码 - 在这种情况下应该是 500 内部错误。

This was being generated as part of a C# web application using service stack that requires an error code to be explicitly set.

这是作为 C# web 应用程序的一部分使用服务堆栈生成的,需要显式设置错误代码。

IE seemed to leave the connection open, eventually network layer closed it and it 'aborted' the request; despite receiving the content and other headers.

IE 似乎让连接保持打开状态,最终网络层关闭它并“中止”请求;尽管收到了内容和其他标题。

Updating the web application to correctly return the status code fixed the issue.

更新 Web 应用程序以正确返回状态代码修复了该问题。

Perhaps there is an issue with how IE is handling the headers in posts.

也许 IE 处理帖子中的标题存在问题。

Hope this helps someone!

希望这可以帮助某人!