Javascript IE11 HTTPS AJAX XMLHttpRequest:网络错误 0x2eff,由于错误 00002eff 无法完成操作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34049814/
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-08-23 15:51:16  来源:igfitidea点击:

IE11 HTTPS AJAX XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff

javascriptajaxinternet-explorerpostjboss

提问by user1707141

I have an ajax POST request that can take anywhere between 2 seconds to 30+ minutes. The post request occurs as a result of button click

我有一个 ajax POST 请求,可能需要 2 秒到 30+ 分钟之间的任何时间。发布请求是由于单击按钮而发生的

If the request takes less than a minute or two, it comes back with a response and everything works fine. However if the request takes longer than two minutes it comes back with "Network error: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff".

如果请求不到一两分钟,它就会返回响应并且一切正常。但是,如果请求时间超过两分钟,它会返回“网络错误:XMLHttpRequest:网络错误 0x2eff,由于错误 00002eff 无法完成操作”。

Ofcourse, it works fine Firefox and Chrome.

当然,它在 Firefox 和 Chrome 上运行良好。

The application is deployed on a JBoss server with SSL enabled. The architecture here is that we have a load balancer that routes the request to two Jboss servers.

该应用程序部署在启用了 SSL 的 JBoss 服务器上。这里的架构是我们有一个负载均衡器,它将请求路由到两个 Jboss 服务器。

Internet Explorer

IE浏览器

Version: 11.0.9600.180971C Update: 11.0.25

版本:11.0.9600.180971C 更新:11.0.25

I have tried the following but in vain

我尝试了以下但徒劳无功

1) ajax set cache to false - did not work

2) Changed registry settings as per https://support.microsoft.com/en-us/kb/813827- did not work, here is where it gets confusing, thissuggests it is not an IE thing, but at the same time this works on chrome and ff so its not a server thing too

3) Set ajax timeout to 0 - did not work 4) Added e.preventDefault after $('#mdlSgn').click(function() { as per jQuery Ajax requests are getting cancelled without being sent

1) ajax 将缓存设置为 false - 不起作用

2) 根据https://support.microsoft.com/en-us/kb/813827更改注册表设置- 不起作用,这是令人困惑的地方,这表明它是不是 IE 的东西,但同时这适用于 chrome 和 ff,因此它也不是服务器的东西

3) 将 ajax 超时设置为 0 - 不起作用 4) 在 $('#mdlSgn').click 后添加 e.preventDefault (function() { as per jQuery Ajax 请求被取消而不发送

$('#mdlSgn').click(function() {
    $('#cnfdsgl').modal('hide');

     $.ajax({
        url: ajaxUrl,
        type: "POST",
        data: JSON.stringify(input),
        contentType: "application/json; charset=UTF-8",
        dataType: "json",
        success: function(data) {
             /// some logic


        },
        error : function(jqXhr, textStatus, errorThrown) {
            /// some logic
        }
    });

 //some other logic
}); 

回答by Jo VdB

We spend multiple days searching for the cause of this problem!

我们花了几天时间寻找这个问题的原因!

  • In the console: SCRIPT7002: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff.
  • In the network tab of IE/Edge, we see the failed request as 'Pending...'
  • XmlHTTPRequest/JQuery returns 404 error at the client, but the server returned a successfully 200 response.
  • No response headers returned
  • 在控制台中:SCRIPT7002: XMLHttpRequest: Network Error 0x2eff,由于错误 00002eff 无法完成操作。
  • 在 IE/Edge 的网络选项卡中,我们看到失败的请求为“待处理...”
  • XmlHTTPRequest/JQuery 在客户端返回 404 错误,但服务器成功返回 200 响应。
  • 没有返回响应头

We only had this problem when using all of these:

我们只在使用所有这些时遇到了这个问题:

  • HTTP/2
  • POST requests
  • Windows 10
  • IE or Edge
  • HTTP/2
  • POST 请求
  • 视窗 10
  • IE 或 Edge

Apparently it is a Windows 10 bugin the HTTP stack that is now solved in Windows 10 version 1803 (April 2018). So normally this problem will disappear over time for people/companies using auto updates of Windows. used Windows 10 versions WorldWide

显然,这是HTTP 堆栈中的Windows 10 错误,现在已在 Windows 10 版本 1803(2018 年 4 月)中解决。因此,对于使用 Windows 自动更新的个人/公司来说,这个问题通常会随着时间的推移而消失。使用 Windows 10 版本 WorldWide

We tested this on an older and newer version of Windows 10 and it is indeed solved.

我们在较旧和较新版本的 Windows 10 上对此进行了测试,确实已解决。

Some temporary solution could be:

一些临时解决方案可能是:

  • disable HTTP/2 for IE and Edge and use HTTPS (server side change).
  • use GET (if possible)
  • does PUT also has this problem?
  • do some retries if no response headers are returned
  • accept that IE/Edge users will be punished ;-)
  • 为 IE 和 Edge 禁用 HTTP/2 并使用 HTTPS(服务器端更改)。
  • 使用 GET(如果可能)
  • PUT也有这个问题吗?
  • 如果没有返回响应头,请重试
  • 接受 IE/Edge 用户将受到惩罚 ;-)

回答by ujeenator

can take anywhere between 2 seconds to 30+ minutes

可能需要 2 秒到 30+ 分钟之间的任何时间

I assume this is because of large amount of data to transfer.

我认为这是因为要传输大量数据。

I have creating large file uploader, that handles 20GB+ video files and may last for several hours.

我创建了大文件上传器,可以处理 20GB 以上的视频文件,可能会持续几个小时。

In my experience - uploading large data with single ajax request can cause strange browser crashes (for example my Chrome browser crashes in about 20% of upload tests).

根据我的经验 - 使用单个 ajax 请求上传大数据可能会导致奇怪的浏览器崩溃(例如,我的 Chrome 浏览器在大约 20% 的上传测试中崩溃)。

The most reliable way, what I found, is to split data in chunks of 1MB and send them sequentially to the server by separate ajax requests.

我发现最可靠的方法是将数据分成 1MB 的块,然后通过单独的 ajax 请求将它们按顺序发送到服务器。

回答by aleha

In my case it was custom response code (3020) returned from server. Switched it to 200 and modified SPA client logics, this solved the issue.

在我的情况下,它是从服务器返回的自定义响应代码(3020)。将其切换到 200 并修改了 SPA 客户端逻辑,这解决了问题。