开发者

Avoiding 504 on remote server .NET

开发者 https://www.devze.com 2022-12-10 23:28 出处:网络
I 开发者_高级运维am using HttpWebRequest to download a remote file, however i get a 504 error.

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?


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.


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.


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

variable=value&

Maybe the server is waiting for POST data.

0

精彩评论

暂无评论...
验证码 换一张
取 消