In .NET Core, a new type System.Net.Http.SocketsHttpHandler, and a rewritten System.Net.Http.HttpMessageHandler are added. They form the basis of higher-level networking APIs.
System.Net.Http.SocketsHttpHandler is the basis of the HttpClient implementation.The sockets implementation introduced in .NET Core 2.1 has a number of advantages:
If this change is undesirable, you can configure your application to use the older System.Net.Http.HttpClientHandler class instead in a number of ways:
By calling the AppContext.SetSwitch method as follows:
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
By defining the System.Net.Http.UseSocketsHttpHandler switch in the .netcore.runtimeconfig.json configuration file:
"runtimeOptions": {
"configProperties": {
"System.Net.Http.UseSocketsHttpHandler": false
}
}
By defining an environment variable named DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER and setting it to either false or 0.
On Windows, you can also choose to use System.Net.Http.WinHttpHandler, which relies on a native implementation, or the SocketsHttpHandler class by passing an instance of the class to the HttpClient constructor.
HttpClient on a per-process basis.libcurl if you want to use the old HttpClient implementation.