简体   繁体   English

IE11 Ajax 在 5 分钟后中止

[英]IE11 Ajax Aborted After 5 Minutes

Does IE11 automatically abort AJAX requests if it takes too long to get a response?如果获得响应的时间过长,IE11 是否会自动中止 AJAX 请求? Using Angular4, I'm creating a fairly simple call:使用 Angular4,我创建了一个相当简单的调用:

this.http.post(url, requestJson, options)
    .map((response: Response) => <string>response.json())

But, this runs for a pretty long time on the server before responding.但是,这会在响应之前在服务器上运行很长时间。 What I'm experiencing is IE is aborting the request after 5 minutes.我遇到的是 IE 在 5 分钟后中止请求。 On Chrome, I don't see the request being aborted.在 Chrome 上,我没有看到请求被中止。

When the request aborts, I get the error: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3.当请求中止时,我收到错误消息: XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3 无法完成操作。 which, according to MS's documentation means ERROR_INTERNET_INCORRECT_HANDLE_STATE.根据MS 的文档,这意味着 ERROR_INTERNET_INCORRECT_HANDLE_STATE。

Looking at Wireshark, I'm seeing IE is sending a TCP reset at the same time.查看 Wireshark,我看到 IE 同时发送 TCP 重置。

I only experience this behavior talking with our server - the request is not aborted when running the site and server locally.我只在与我们的服务器交谈时遇到这种行为 - 在本地运行站点和服务器时,请求不会中止。

Is there a way to modify this timeout so that it does not abort?有没有办法修改此超时以使其不会中止? Note: A more long-term solution we'll work towards is modifying the behavior of this request so the request is not hanging for minutes before receiving a response (set up some kind of notification system for when long-running requests are done).注意:我们将努力实现的一个更长期的解决方案是修改此请求的行为,以便请求在收到响应之前不会挂起几分钟(为长时间运行的请求完成时设置某种通知系统)。

Things I've tried, that have not solved the problem:我尝试过的事情并没有解决问题:

  • I've set the XMLHttpRequest object's timeout to 0.我已将 XMLHttpRequest 对象的超时设置为 0。
  • I've set the Observable's timeout to a large value.我已将 Observable 的超时设置为一个较大的值。

You might consider transitioning to Websockets or Long Polling if you are going to have long wait times.如果您要等待很长时间,您可以考虑过渡到 Websockets 或长轮询。 This seems like an appropriate application to move the client/server communication to something that is better suited to long delays in communication.这似乎是一个合适的应用程序,可以将客户端/服务器通信转移到更适合长时间通信延迟的地方。 I'm not sure why IE11 would behave like this, however, it sounds like you have a long wait and if the server gets loaded down even more at one time this can cause the response time to be further delayed.我不确定为什么 IE11 会这样,但是,听起来您要等待很长时间,并且如果服务器一次加载得更多,这可能会导致响应时间进一步延迟。 Is this an option for you?这是您的选择吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM