I’m trying to set up a web app project in visual studio 2022 and when I run it asks me to trust SSL and it says there was an error trusting and always start in untrusted mode in the browser.
I tried running
dotnet dev-certs https --clean
dotnet dev-certs https --trust
but I get an output saying there was an error trusting https certificates.
These are the details if I run info if it matters:
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.400
Commit: 7771abd614
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk6.0.400
global.json file:
Not found
Host:
Version: 6.0.8
Architecture: x64
Commit: 55fb7ef977
.NET SDKs installed:
3.1.120 [C:Program Filesdotnetsdk]
6.0.400 [C:Program Filesdotnetsdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.8 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.26 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.30 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.8 [C:Program FilesdotnetsharedMicrosoft.WindowsDesktop.App]
3
Answers
I tried all the suggestions written in this post and nothing worked. Re-installed windows and now I got no issues with certificates. It ain't stupid if it works?
I was having the same problem. After running the codes you specified. I restarted my computer and problem solved.
Also, when you run the project again, the option to trust SSL certificate should appear.
You must select yes for both options.
enter image description here
enter image description here
For problems getting an untrusted certificate warning, you can try using a PowerShell script.
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/installation/warnings-untrusted-certificate#method-1-use-a-powershell-script
Another way is to configure the computer to trust the IIS Express certificate
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/installation/warnings-untrusted-certificate#method-2-configure-computers-to-trust-the-iis-express-certificate