Differences HttpClient .NET Core and .NET Framework (SocketsHttpHandler vs. HttpWebRequest)

Viewed 1601

I tried to consume a CRM2011 SOAP service with the HttpClient in .NET Core using windows authentication. The webserver was always able to authenticate me but CRM was not. Therefore I tried the same code inside a .NET Framework project and the request worked fine on the first try.

Then I tracked and compared the .NET Core and .NET Framework requests with Fiddler and recognized that the authorization header value was different.

After further investigation I found a list of the transports for each host and runtime which are used by the HttpClient on Microsoft docs: https://docs.microsoft.com/dotnet/api/system.net.http.httpclient?view=netcore-3.1

.NET Framework uses the HttpWebRequest and .NET Core uses the SocketsHttpHandler.

Then I found another post on Microsoft docs how to avoid using the SocketsHttpHanlder in .NET Core: https://docs.microsoft.com/dotnet/api/system.net.http.socketshttphandler?view=netcore-3.1

After disabling the handler in .NET Core the request worked as well. I guess that those handlers are using different TLS versions or hashing algorithms or something like that, but I am not able to find the differences between them.

Does anyone know the differences or a source where they are listed?

0 Answers
Related