ajax 是什么引发了 HTTP 503 以及如何更改超时?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/703702/
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
What raises HTTP 503 and how to change timeout?
提问by Christopher Graziano
I have inherited an application (internal to my company) that uses javascript running in Internet Explorer which makes Ajax calls to a Struts-based application running in WebLogic Server v10.
我继承了一个应用程序(我公司内部的),它使用在 Internet Explorer 中运行的 javascript,它对在 WebLogic Server v10 中运行的基于 Struts 的应用程序进行 Ajax 调用。
Certain server-side operations in the system are taking longer than 3 minutes. Users consistently noticed that the Ajax call returns 503 error at the 3 minute mark. My users can wait longer than 3 minutes, but 503 errors interrupt their work.
系统中的某些服务器端操作需要超过 3 分钟。用户一直注意到 Ajax 调用在 3 分钟标记处返回 503 错误。我的用户可以等待超过 3 分钟,但 503 错误会中断他们的工作。
This application needs to be performance tuned, but we badly need a temporary workaround to extend how much time can occur before a 503 error is returned.
这个应用程序需要进行性能调整,但我们非常需要一个临时的解决方法来延长在返回 503 错误之前可以发生的时间。
The current theory is that the 503 error is being raised by the IE XMLHttpRequest object. A team of supposed WebLogic experts poured over our code and WebLogic logs, and declared that there's no timeout occurring on the server side. But I have my doubts.
当前的理论是 503 错误是由 IE XMLHttpRequest 对象引发的。一组假定的 WebLogic 专家倾注了我们的代码和 WebLogic 日志,并宣布服务器端没有发生超时。但我有我的疑问。
My question is, which piece of software is responsible for raising 503 error: the browser, the Ajax javascript, or the server? And can this timeout period be changed?
我的问题是,哪个软件负责引发 503 错误:浏览器、Ajax javascript 或服务器?这个超时时间可以改变吗?
回答by Andy White
A 503 error is kind of a catch-all for a lot of different types of errors, usually on the server side. In your case it could be that the server is just rejecting the connection after a certain timeout, and responding back with a 503 to indicate that the server is overloaded or cannot process your request.
503 错误是许多不同类型错误的统称,通常在服务器端。在您的情况下,可能是服务器在特定超时后拒绝连接,并以 503 响应以指示服务器过载或无法处理您的请求。
A lot of times with web services, a 503 will be returned when the server code throws an exception or error. If the server code doesn't properly handle the error, it will bubble up to the server, which will just respond back with a generic 503.
很多时候使用 Web 服务,当服务器代码抛出异常或错误时,将返回 503。如果服务器代码没有正确处理错误,它会冒泡到服务器,服务器只会用通用的 503 响应。
http://www.checkupdown.com/status/E503.html
http://www.checkupdown.com/status/E503.html
回答by dwc
503 is a server error. XMLHttpRequest will happily wait longer than 3 minutes. The first thing you should do is satisfy yourself of that by visiting the problem URL in telnet or netcat or similar and seeing the 503 with javascript out of the picture.
503 是服务器错误。XMLHttpRequest 很乐意等待超过 3 分钟。您应该做的第一件事是通过访问 telnet 或 netcat 或类似工具中的问题 URL 并在图片中看到带有 javascript 的 503 来满足自己。
Then you can proceed to find the timeout on the server side.
然后您可以继续查找服务器端的超时。
回答by hrabinowitz
503 is most likely due to a timeout on the server. If you can tune your Apache server, read about the Timeout attribute that you can set in httpd.conf. Look in the httpd/logs/error_log to see if timeouts are occurring. Refer also to this answer: Mod cluster proxy timeout in apache error logs.
503 很可能是由于服务器超时。如果您可以调整 Apache 服务器,请阅读可以在 httpd.conf 中设置的 Timeout 属性。查看 httpd/logs/error_log 以查看是否发生超时。另请参阅此答案:Apache 错误日志中的 Mod 集群代理超时。
回答by Steven Huwig
Your web server has a request reply timeout which is being tripped by long-running service requests. It could be the WebLogic server or a proxy. It is certainly not the client.
您的 Web 服务器有一个请求回复超时,它被长时间运行的服务请求所触发。它可以是 WebLogic 服务器或代理。肯定不是客户。
Have you considered submitting an asynchronous HTTP request that will be responded to immediately, and then polling another location for the eventual results? Three minutes is about 170 seconds too long.
您是否考虑过提交将立即响应的异步 HTTP 请求,然后轮询另一个位置以获得最终结果?三分钟太长了大约 170 秒。

