Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted

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...
 
Share this answer
 
Have a look at this one..it looks similar..
the-remote-server-returned-error-504[^]
 
Share this answer
 
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.
 
Share this answer
 
v2
Comments
Member 11148754 5-Oct-18 6:24am    
copycat
https://stackoverflow.com/questions/18665756/difference-between-operation-has-time-out-and-504-gateway-timeout

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900