I am trying to run ASP MVC application with SSL mode set to true and whenever i run the application, i get prompt to trust the IIS Express SSL certificate. Upon clicking Yes
It worked to me just running CMD > certlm and deleting the localhost certificate inside the personal folder.
After having struggled with this issue now for a week (using Win 10 and Visual Studio 2019 Community Edition Version 16.1.1) and trying various solutions I found out the following:
Repairing IISExpress 10 (Programs -> Programs and Features) will create a new localhost certificate also in: Certificates (Local Computer) -> Personal
Then export that certificate by saving it to a file using:
Then import that certificate into: Certificates (Local Computer) -> Trusted Root Certification Authorities
I also tried to use "dotnet dev-crts https --trust" but that did not work for me and always produced the following error:
So to wrap it up: make shure there is only 1 localhost certificate which is in Certificates (Local Computer) -> Trusted Root Certification Authorities
Update: I just realized that after modifying the web application a few times a different error manifested and I had to go through the whole process again in order to get it to work!
My error was actually "asp.net developer certificate is not installed" but I think the solution below would still work in this case. Execute the following commands in command prompt.
dotnet dev-certs https --trust --check
echo Trust check: %errorlevel%
dotnet dev-certs https --trust -ep "%APPDATA%\ASP.NET\https\TestCert.pfx" -p TestPassword
echo Trust/Export: %errorlevel%
Reference: https://github.com/Microsoft/DockerTools/issues/147#issuecomment-420433974
You can use powershell to move the certificate from the personal store to the trusted (root) store.
$cert = (Get-Childitem cert:\LocalMachine\My | Where-Object { $_.subject -eq 'localhost' }).Thumbprint
copy-item -path cert:\LocalMachine\My\$cert -Destination cert:\LocalMachine\Root\
Here's my first time answer. I have solved the issue using this method.
After that go to personal -> Certificates and find localhost
drag localhost to trusted root certifications Authorities -> Certificates
Now structure list issue resolved as first it wasn't permitting to import in user certificates.
So, now go to start type certificate again but instead of manage computer certificate go to manager user certificates and do the same drag and drop from personal to trusted root certification authorities -> certificate folder.
Note: In case you have deleted localhost from personal then just import it by first opening the visual studio project on chrome you will see certificate details in left of address bar and export that certificate and import that certificate to personal -> certificate folder
I'm a total noob on this and wanted to share the solution I found after struggling some time and reading many posts. It is very similar to what sanjeev posted, however with more detail so if you are new to this (as myself), you can solve it faster.
If you have this issue with Visual Studio 2019 and Win 10, delete all localhost certificates at MMC: (1) cmd>run as admin>type "mmc" and press enter (2) File>Add/Remove Snap-in... (3) Select "Certificates" and click Add button (4) Select options "Computer Account" and "Local computer" (5) Console Root folder > click and expand Certificates (6) Delete all localhost certificates at different folders
Then at Control Panel>Program and Features find IIS 10.0 Express at the list, right click and select "Repair". This will create a new localhost certificate at the Certificate's "Personal" folder (at the MMC window used previously - don't forget to refresh to see this new certificate)
Copy (right click on the certificate) this certificate located in the "Personal" folder and paste it into the folder "Trusted Root Certification Authorities">"Certificates"
DELETE the localhost certificate from the "Personal" folder. There should be only one localhost certificate and located at the "Trusted Root Certification Authorities" folder
After this, it should work fine, hope you find this useful