0

I have a strange problem with httpClient. I am trying to make GET request to remote API. The cUrl is working perfectly from terminal, but the httpClient with the same request, is only going to timeout. I've created the httpClient using https://curl.olsh.me/ tool and set the wait time to 2 minutes. After the request is fired, it waits, but gets no response code, and goes to exception

2021-04-23 03:40:22.686 +01:00 [INF] {httpRequest} 
2021-04-23 03:42:02.798 +01:00 [ERR] Exception Message : The operation has timed out. 

Can you please make any guess what can be a problem. Thank you in advance

Kattarina
  • 79
  • 1
  • 2
  • 11
  • 4
    Could you show us your code? – tymtam Apr 23 '21 at 08:10
  • 1
    Might be a similar problem to https://stackoverflow.com/questions/66072583/download-webp-image-from-url-with-c-sharp/66072825#66072825 – NineBerry Apr 23 '21 at 08:44
  • 2
    Failes like this usually is due to three different issues 1) If error occurs after 30 seconds it means a proxy timeout. A proxy was being used and the proxy never responded 2) A HTTP header in the request is wrong or missing. The default headers in c# are different than other languages. 3) You are using HTTPS (secure) and the TLS authentication that is used is failing. Cookies are probably not the issue. A cookie is established when a connection is first made. Then the cookie is used on subsequent contection to reduce time to make connecton. A cookies would only help. Not cause failure. – jdweng Apr 23 '21 at 09:27

1 Answers1

0

Thanks everyone who commented, especially to @jdweng . It gave me some idea where to search for the problem. So, the timeout problem was caused by TLS authentication. The root certificates were not imported on server. After importing root certificates, the problem was solved.

The bad thing is that it was impossible to figure out the exact problem from an exception text.

Kattarina
  • 79
  • 1
  • 2
  • 11