3

I am hosting my IdentityServer, Web API and MVC client apps all with IIS server, under HTTPS. When I run the my MVC client I get the following error back (note - 6009 is the port of my MVC client and 6005 is the port of my IdentityServer):

enter image description here

I am using IIS Express Development Certificate for all projects when I configure them in IIS:

enter image description here

and I copied the certificate from the personal store to the trusted root as the following:

enter image description here

and here is the details of the cert:

enter image description here

what else am I missing here?

Alexu
  • 1,015
  • 2
  • 12
  • 32
  • 1
    You can refer to the [official link](https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-5.0&tabs=visual-studio#os-x---certificate-not-trusted),and try the commands in it.If it still cannot work,you can refer to the [link](https://stackoverflow.com/questions/64984519/dotnet-5-on-mac-with-is4-returns-ssl-connection-could-not-be-established) – Yiyi You Feb 18 '21 at 05:36
  • Thanks Yiyi You. The "dotnet dev-certs https --trust" command worked for me. – Alexu Feb 18 '21 at 15:24
  • Hello,I have changed my comment to an answer,if it is helpful,can you accept it as answer?Thank you. – Yiyi You Feb 19 '21 at 01:14
  • Sure, I would love to do that. Thanks again, Yiyi You! – Alexu Feb 19 '21 at 15:46

2 Answers2

10

You can refer to the official link,and try the commands in it.

dotnet dev-certs https --clean
dotnet dev-certs https --trust
Yiyi You
  • 16,875
  • 1
  • 10
  • 22
8

For me, neither dotnet dev-certs https --clean/trust nor manually cleaning the Windows certificate stores worked out.

Since I was using Docker and Kestrel (instead of ISS), for some reason, it was using outdated certificates located under: C:\Users\<user>\AppData\Roaming\ASP.NET\Https\<project-name>.pfx The dotnet dev-certs https --clean command did not clean up the certificates in this directory.

After cleaning the certificates in this directory, everything worked again. I'm aware that your problem is already resolved, but since this is a common issue I figured I would also post my solution here.

Related issue about why the clean command does not clean these certs can be found here: https://github.com/dotnet/aspnetcore/issues/15357

Dharman
  • 30,962
  • 25
  • 85
  • 135
Rubbertjuh
  • 95
  • 1
  • 7
  • Thank you very much! Took some time to find that answer that solved the issue. – Hulkstance May 01 '22 at 13:10
  • Running the clean command, deleting the files from ```ASP.NET\Https``` and then running trust again, fixed my problem. Faced it for a couple of days, many thanks ! – Br4infreze Jul 11 '22 at 17:23