We need to talk to a third-party system through HTTP POST requests - depending on the parameters of such requests, it happens that processing time exceeds 5 minutes.
We have no issue fetching the data with CURL or Postman in such cases, but for some reason our HttpClient implementation hangs/remains stuck. Even creating an ad-hoc Console Application to talk to the server results in the following behavior:
Request starts -> Wait until whatever timeout we have set on HttpClient is triggered -> Tieout Exception. In other words, it appears that the response being sent by the server is "ignored" and the component waits for timeout. We are able to successfully make request from the same machine by using CURL or Postman, so I doubt it's machine-dependent.
Of course, the timeout is higher than the server response time, and we can confirm that the server is actually processing & sending the response through.
Size of the response payload does not change significantly with processing time - it seems that the only variable here is processing time itself.
Any clue / ideas for troubleshooting this?
Editing to add code (.NET 4.5):
var content = new StringContent("{}", Encoding.UTF8, "application/json");
client.Timeout = TimeSpan.FromMinutes(8);
var response = client.PostAsync("https://destination.service.com/myendpoint", content).Result;
var responseString = response.Content.ReadAsStringAsync().Result;
This is from a small testing C# Console Application that we created to troubleshoot the issue - really nothing too fancy as you can see.