简体   繁体   English

在Android中获取503作为Http响应?

[英]Getting 503 as Http response in android?

Please check my logcat.This is what I get when I parse the http response. 请检查我的logcat。这是我解析http响应时得到的。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
   <head>
      <title>503 Service Unavailable</title>
   </head>
   <body>
      <h1>Error 503 Service Unavailable</h1>
      <p>Service Unavailable</p>
      <h3>Guru Meditation:</h3>
      <p>XID: 1294992728</p>
      <hr>
      <p>Varnish cache server</p>
   </body>
</html>

I am getting this response while uploading an image from android to server.Can anyone help me out with this problem? 我在将图像从android上传到服务器时得到了这个响应。任何人都可以帮我解决这个问题吗?

5xx type of error is a server side error. 5xx类型的错误是服务器端错误。 List of HTTP status codes at wiki states that Error code 503 means The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. 维基的HTTP状态代码列表表示错误代码503表示The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. So, in short your server seems to be down. 所以,简而言之,你的服务器似乎已经失败了。

Hope this information helps. 希望这些信息有所帮助

As you have stated that the Error is 503 from server, Please check this link once. 如您所说,服务器的错误是503,请检查此链接一次。 It states that the 503 error may occur due to following reasons: 它声明可能由于以下原因而发生503错误:

  1. Obtain an IP address from the IP name of the site (the site URL without the leading 'http://'). 从站点的IP名称(没有前导'http://'的站点URL)获取IP地址。 This lookup (conversion of IP name to IP address) is provided by domain name servers (DNSs). 此查找(将IP名称转换为IP地址)由域名服务器(DNS)提供。
  2. Open an IP socket connection to that IP address. 打开与该IP地址的IP套接字连接。
  3. Write an HTTP data stream through that socket. 通过该套接字写入HTTP数据流。
  4. Receive an HTTP data stream back from the Web server in response. 作为响应,从Web服务器接收HTTP数据流。 This data stream contains status codes whose values are determined by the HTTP protocol. 此数据流包含状态代码,其值由HTTP协议确定。 Parse this data stream for status codes and other useful information. 解析此数据流以获取状态代码和其他有用信息。

It's hard to tell without actually seeing your VCL file... but taking account that you get that error while uploading (a POST request) I guess you're hitting one of the the backend timeouts[1]. 没有实际看到你的VCL文件很难说...但是考虑到你在上传时遇到了这个错误(一个POST请求)我猜你正在击中其中一个后端超时[1]。

Try to rise timeouts and see if the error persists: 尝试提高超时并查看错误是否仍然存在:

backend default {
  .host = "your.host.tld"; //Use your current setting
  .port = "XXX";           //Use your current setting
  .connect_timeout = 300s;
  .first_byte_timeout = 600s;
  .between_bytes_timeout = 600s;
}

[1] https://www.varnish-cache.org/docs/3.0/reference/vcl.html?highlight=timeout#backend-declarations [1] https://www.varnish-cache.org/docs/3.0/reference/vcl.html?highlight=timeout#backend-declarations

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

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