20

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.

maccettura
  • 10,514
  • 3
  • 28
  • 35
Seyfullah C
  • 209
  • 2
  • 3
  • Do you think it'd be possible for you to provide some more information? – rustyshackleford Jul 12 '18 at 17:52
  • Right now this looks like a duplicate of a number of TLS questions with the same error message. For example, https://stackoverflow.com/questions/30664566/authentication-failed-because-remote-party-has-closed-the-transport-stream –  Jul 12 '18 at 17:55
  • It does look like an issue with self-signed certificate for localhost that used by Kestrel – Pylyp Lebediev Aug 29 '18 at 09:58

2 Answers2

22

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

Marcus Wong
  • 341
  • 3
  • 15
  • upvote for the actual answer (Kestrel simply isn't ready by the time the request happens) but sadly no combination of messing about with the settings seems to work for me; the only thing that does work so far is to simply Un-check the "Launch Browser" option in the VS Project options (Debug tab), then once it's running manually browse to the site's URL. – GPW Apr 05 '19 at 09:43
0

can you try running the command dotnet dev-certs https --trust

If your development certificate is not trusted, it should prompt you to accept it. My issue got resolved after running it. and next time you run the command again,it will tell you that the certificate is valid.

enter image description here

Nishank
  • 159
  • 1
  • 11