Hello guys right now I am using .net core 2.1.3 when I install webapi project by "dotnet new webapi" when I try to open by firefox or chrome it gives me this error
HttpsConnectionAdapter[1] Failed to authenticate HTTPS connection. System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
It is recommended for an ASP.NET Core application to use: - HTTPS Redirection Middleware (UseHttpsRedirection) to redirect HTTP requests to HTTPS. - HSTS Middleware (UseHsts) to send HTTP Strict Transport Security Protocol (HSTS) headers to clients. Remediation.
UseHttpsRedirection(); is a single line code, which you have to write under Configure method to secure . NET Core solutions. Moreover, you don't always have to configure this middleware, as most ASP.NET web app templates, such as MVC, come with it by default enabled with it.
I face the same problem. In my test, it seems the problem using Kestrel with SSL. (other IISExpress is OK)
It look like the SSL is not ready yet, when you browse it.
The workaround for me is just simply change the position in launchSetting:
"applicationUrl": "https://localhost:443;http://localhost:80"
to
"applicationUrl": "http://localhost:80;https://localhost:443"
With app.UseHttpsRedirection();
in Startup.cs
it will go to port 80 first and then redirect to port 443
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With