如何解决504-网关超时错误/异常 [英] How to resolve 504- Gateway Timeout error/exception

查看:1561
本文介绍了如何解决504-网关超时错误/异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想从网络机器访问数据。对于它,我使用WebClient.DownloadData()方法,该方法将参数作为Document和凭证的URL。如果我通过IIS服务器执行包含WebClient.DownloadData()方法的代码,则会将异常显示为System.Net.WebException:远程服务器在System.Net.WebClient上返回错误:(504)Gateway Timeout。 System.Net.WebClient.DownloadData(Uri地址)中的DownloadDataInternal(Uri地址,WebRequest和请求)。



但是如果我通过传递相同的参数使用Windows应用程序运行相同的代码,那么它会正确执行。即使在本地计算机上通过ISS服务器运行相同的代码(如果我们从同一台机器访问数据),它也会正确执行。



如果有人知道如何解决它,请告诉我。



提前致谢。







谢谢,



Hanumant

Hi,

I want to access data from network machine. For it, I am using WebClient.DownloadData() method which takes parameter as URL of Document and credentials. If I executes code which contains the WebClient.DownloadData() method through IIS server it shows exception as "System.Net.WebException: The remote server returned an error: (504) Gateway Timeout. at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadData(Uri address)".

But if I runs the same code using windows application by passing same parameters then it executes properly. Even If run same code through ISS server on a local machine(if we access data from same machine) then it executes properly.

If anyone have any idea about how to resolve it then please let me know.

Thanks in advance.



Thanks,

Hanumant

推荐答案

嗨学习者的朋友,



我在博客中尝试过给定的信息。但它不适合我。由于这个错误我正在阻止。请帮帮我...
Hi learner'sbug,

I have tried the given information in the blog. but its not working for me. I am getting block due to this error. Please help me...


看看这个..看起来很相似..

-remote-server-returned-error-504 [ ^ ]
Have a look at this one..it looks similar..
the-remote-server-returned-error-504[^]


其原因有以下几点: -



操作超时表示发送请求的程序已超时等待响应。这可能意味着:



互联网连接不良(如果他们都抛出这个错误那么这很可能)。

主机连接错误(您连接的任何人都有问题)。

错误的DNS (如果主机是域名,则可能是罪魁祸首)。

错误的主机代理(主机端的某些东西没有正确响应)。

在这些情况下我会手动测试连接受影响的主机并以这种方式解决这些问题。首先尝试测试您自己的连接以及其他主机。如果问题是特定的主机,那么他们可能会遇到与您联系的问题。



当您收到504 - 网关超时时,表示您的程序确实成功连接到主机,但主机端出现问题,无法返回所需的响应。这不是连接问题,而是请求或主机本身的问题。可能是主机陷入无限循环试图处理您的请求,或者只是挂起,处理您请求的代理人放弃并发回您的请求。



在这些情况下,我会查看主机,可能正在运行主机将接受的测试请求。如果主持人不在您的控制之内,那么请联系任何人并报告错误。



所以 - 简而言之。第一个超时可能与连接有关,而504超时可能是主机处理。希望这会有所帮助。
Its cause due to some below points :-

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

Bad internet connection (if they are all throwing this error then this is likely).
Bad host connection (whomever you are connecting to has a problem).
Bad DNS (if the host is domain name this could be a culprit).
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.


这篇关于如何解决504-网关超时错误/异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆