timeout behaviour of httpClient in C#

454 views Asked by At

I have a question about HttpClient. I use it like this

HttpClient client = new HttpClient(MyHandler, false);

I use WebRequest.GetSystemproxy() for the handler

At some point, it lose the connection with the server and raise exceptions (taskcancel , it seems to be timeout, I don't have more explicite log at this time).

The only solution i have is to do a new httpClient, after that it works well for a new period.

I don't understand why?

in http 1.1, connexion can be close by server when it wants or needs. If server close connexion will httpclient initialize a new one? or it's just the "why" I have this problem?

I read that httclient can be reused (here and elsewhere) and it designed for that but it's not what I see in my case. After some httprequests, I can't reuse it.

0

There are 0 answers