I want to try net5.0 since it's in rc2, and I've encountered a strange issue.
I've created a default WebApi in net5.0. I didn't touch anything, I just clicked run (in kestrel, not ISS) and the Swagger home page shows up. I tried the WeatherForcast get and everything is working fine.
then I created a console app in NET5.0 and added this code :
static async Task Main(string[] args)
{
var clientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
};
var client = new HttpClient(clientHandler);
try
{
var httpMessage = await client.GetAsync("https://localhost:5001/WeatherForecast");
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
and with this code I got the following error :
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.IO.IOException: Cannot determine the frame size or a corrupted frame was received.
after that, I tried on Postman the same request and it worked (as from swagger).
My final test was to switch the console app to netcore 3.1 and the request worked.
So I only got this error on net5.0 app.
Any suggestions ?
EDIT :
- Here are my pc info : W10 Enterprise, V 1809, Build 17763.1518.
- I only got the error on the Net5.0 console.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…