Difference between operation has time out and (504) Gateway Timeout

后端 未结 4 906
暗喜
暗喜 2021-01-04 02:21

I am using HttpWebRequest in my application which is checking some URI\'s in multiple threads. I am getting multiple types of time out exceptions.

    <
相关标签:
4条回答
  • 2021-01-04 02:41

    The operation has timed out is a client error. It is usually caused by various *Timeout properties of WebRequest (and its descendants): Timeout, ContinueTimeout, ReadWriteTimeout. If the server you sent request to does not respond within the timeout you set, you get TimeoutException.

    To avoid this error, you can increase timeouts. However, they are quite big by default, so increasing is unlikely to help. You can try several times. If it doesn't help, the server is probably down.

    504 Gateway Timeout is a server error. It is usually caused by errors in or overloading of the server infrastructure you sent requests to. It is black box for you.

    You can't do anything about this error, only server administrators can resolve that. If the error is caused by overloading, you can try requesting several times, but doing this too often will do more harm than good, obviously.

    In general, if you don't get an HTTP code, it's an exception from .NET. If you do get an HTTP code, you can look at the first digit:

    2** OK
    3** Redirection
    4** Client error
    5** Server error

    0 讨论(0)
  • 2021-01-04 02:55

    You can consult this link for "The operation has timed out" and the issue might be due to the server already busy with some task. And (504) Gateway Timeout means that one server did not receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser.

    0 讨论(0)
  • 2021-01-04 02:59

    The operation has timed out occurs when a specified time is defined and server is not able to respond back in that particular time (occurs inside the remote server)

    while

    504 errors in the HTTP cycle (occurs in communication between client and server) Any client (e.g. your Web browser or our CheckUpDown robot) goes through the following cycle when it communicates with the Web server:

    Obtain an IP address from the IP name of the site (the site URL without the leading 'http://'). This lookup (conversion of IP name to IP address) is provided by domain name servers (DNSs). Open an IP socket connection to that IP address. Write an HTTP data stream through that socket. Receive an HTTP data stream back from the Web server in response. This data stream contains status codes whose values are determined by the HTTP protocol. Parse this data stream for status codes and other useful information. This error occurs in the final step above when the client receives an HTTP status code that it recognises as '504'. (Last updated: March 2012).

    Fixing 504 errors - general

    This problem is entirely due to slow IP communication between back-end computers, possibly including the Web server. Only the people who set up the network at the site which hosts the Web server can fix this problem.

    0 讨论(0)
  • 2021-01-04 03:01

    In lamest terms...

    "Operation Timed Out" means that YOUR program sending the request has timed out waiting for a response. This could mean:

    1. Bad internet connection (if they are all throwing this error then this is likely).
    2. Bad host connection (whomever you are connecting to has a problem).
    3. Bad DNS (if the host is domain name this could be a culprit).
    4. Bad host agent (something on the host end is not responding properly).

    In these cases I would manually test connections to the affected host and resolve these issues in that manner. Try testing your own connection first, and other hosts. If the problem is a specific host then they may have issues you need to contact them about.

    When you get the "504 - Gateway Timeout" it means that YOUR program did successfully connect to the host, but something went wrong on the host end and it could not return a desired response. This is not a connection problem, but a problem in either the request or the host itself. It could be that the host got stuck in an infinite loop trying to process your request, or is simply "hung", and the agent processing your request gave up and sent your request back.

    In these cases I would be looking at the host, maybe running test requests that the host will accept. If the host is not within your control then contact whomever it is and report the error.

    So - in short. The first timeout is likely connection related, while the 504 timeout is likely the host processing. Hope this helps.

    0 讨论(0)
提交回复
热议问题