0

I am trying to post my data using HTTPWebRequest to third party WebAPI. My data gets posted successfully, however in my error log I see a log saying The operation has timed out in (HttpWebResponse)request.GetResponse().

I am unable to find out why though my data is posted successfully. Any suggestions?

Thanks in advance.

LeoNegi
  • 31
  • 11

1 Answers1

0

Your request is sent to server successfully but you fail to get response. If it always happens, maybe the WebAPI takes a lot of time to deal with the request before sending response so that your HttpWebRequest doesn't wait anymore. Try setting HttpWebRequest.Timeout a large value.

skyoxZ
  • 362
  • 1
  • 3
  • 10
  • Thanks skyoxZ...is it fine to set timeout value as Timeout.Infinite, is it recommended? – LeoNegi Jan 23 '18 at 07:14
  • @pallavi Infinite is not recommended. See how much time it takes to get response and set `Timeout` to a value that is large enough to get response most of the time. – skyoxZ Jan 23 '18 at 07:25