user34537
user34537

Reputation:

Avoiding 504 on remote server .NET

I am using HttpWebRequest to download a remote file, however i get a 504 error. I pasted the url in firefox and the first and 3rd try it took 16seconds, the 2nd nothing happened (it looked like it timed out).

How do i decrease the 504 error? Would changing HttpWebRequest timeout help? should i attempt to retry the file (lets say 3 times) if i receive a 504 error?

Upvotes: 1

Views: 3674

Answers (3)

Dima Stebaev
Dima Stebaev

Reputation: 1

Try putting an & at the end of your POST request body:

variable=value&

Maybe the server is waiting for POST data.

Upvotes: -1

feroze
feroze

Reputation: 7594

5xx is a server error. Look at the entity body of the response to see if the server gives any hint as to why this is happening.

You can get the entity body by getting the Response from the WebException object.

Upvotes: 2

Gonzalo
Gonzalo

Reputation: 21175

That's a server problem. There's no way for you to prevent that. I would retry a couple of times adding some Thread.Sleep in between.

Upvotes: 3

Related Questions