6

There are at least 2 handlers which we can use in HttpClient for apps written by Net Framework 4.6.1+, i.e.:

  • HttpClientHandler (part of Net Framework)
  • WinHttpHandler (supplied via Nuget)

There are no articles comparing them by next questions:

  • performance comparison
  • working with DNS shift (when IPs for DNS FQDN is changed)
  • connection lease timeout (when HttpClient doesn't automatically move to new instance when autoscaling)

Could anyone share your experience of usage WinHttpHandler?

1 Answer 1

5

Karel Zikmund wrote answer on my question, you can see it via next url

Starting with .NET Core 2.1, the HttpClientHandler uses by default SocketsHttpHandler - new C# implementation over sockets.

It's key value is consistency across platforms and focus on performance (especially against CurlHandler on Linux/Mac).

WinHttpHandler is wrapper over winhttp OS component. If you need HTTP/2, it is currently the only option as SocketsHttpHandler does not support HTTP/2 yet (see #23134).

DNS changes behave the same behavior on both, however, you can tweak it somewhat via SocketsHttpHandler.PooledConnectionLifetime.

DNS TTL is not supported - see #24257 and #11224. The workaround is to recycle the handler on regular basis. You can also use higher-level wrapper HttpClientFactory which does that for you (at least as a motivation).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.