15

I have a problem with HTTPS when I am running (dotnet run) my .NetCore application locally on Windows. It was working till my localhost certificate expired…

I clean up old certificates and generated the new one by

dotnet dev-certs https –clean dotnet dev-certs https –trust 

I’ve verified that everything was added to certmgr (Personal and Trusted certs), but I have the same problem. It is keep trying to use old certificate which expired. I do not know why it is trying to use old “localhost” certificate after clean up certs…

Do you have any idea what should I do?.

Thank you, Błażej

6
  • Refer to github.com/aspnet/AspNetCore.Docs/issues/13928 and learn.microsoft.com/en-us/aspnet/core/security/… , check platform specific suggestions in above links Commented Oct 15, 2019 at 2:36
  • And try manually remove all the found certificates from both Personal and Trusted root certification authorities , try reinstall again . Commented Oct 15, 2019 at 2:38
  • @NanYu I am using Windows and I was trying every platform specific suggestions which are in above links Commented Oct 15, 2019 at 5:37
  • Do you try to manually remove certs from Personal and Trusted root certification authorities , and try reinstall again ? Commented Oct 15, 2019 at 6:03
  • Yes. I removed localhost certs from .Net Dev Cert and reinstalled them. It does not help me. Currently I am not using a HTTPS on localhost, so I can develop my things, but it will be nice to fix the problem for future Commented Oct 15, 2019 at 7:26

2 Answers 2

40

If not helps recreate cert by commands:

dotnet dev-certs https ––clean dotnet dev-certs https ––trust 

Clean all private keys from folder:

C:\Users\{User}\AppData\Roaming\ASP.NET\Https 
Sign up to request clarification or add additional context in comments.

4 Comments

I've battled this issue for 2 days - cleaning the private keys did the trick. Thanks!!!
I will name my next child after @Maxim
Cleaning the private keys also did the trick for me. Thanks!
Same for me, this should be the aceppted answer
2

You need to use two hyphens. The flag is -t or --trust, not –trust so the following should work:

dotnet dev-certs https --trust 

You can also run the help command to see more info

dotnet dev-certs https --help 

dev-certs https help output

See Also: How to run dotnet dev-certs https --trust?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.