.NET 5 HttpClient Exception: The SSL connection could not be established, Inner: Received an unexpected EOF or 0 bytes from the transport stream

Viewed 840

I have a REST client (System.Net.Http.HttpClient) and host (Microsoft.Extensions.Hosting.Host) built in NET Core 3.0.

I have 2 MSTest UnitTest projects, one .NET Core 3.1 and the other .NET 5.

I have the same test in each MSTest project that opens a host (https://localhost:6001) secured with an X.509 certificate (same X.509 in both tests) and tries to call into the API with a client.

This test works in the .NET Core 3.1 UnitTest project.

The same test fails in the .NET 5 UnitTest project, with the following exception

enter image description here

System event log reports the Schannel errors below when the .NET 5 unit test is run (no errors when the .NET Core 3.1 unit tests are run)

enter image description here

Has anyone encountered this problem and found a solution?

0 Answers
Related