Reputation: 511
I have a fresh install of Visual Studio Community 2019 on a new computer. I started a web app project, ran it for the first time, and then when prompted to accept the self-signed certificate I somehow managed to click "Do Not Ask Again" and "No".
At this point, when running the web app, I get a ERR_CONNECTION_RESET and can't connect to anything. I've tried deleting and recreating the certificate using advice listed here: Re-Installing Visual Studio 2017 Localhost Certificate, as well as reinstalling VS entirely, but neither worked.
To be clear, I messed up, not Visual Studio. As far as I can tell, there's nothing particular about my set up or environment, and I've built web apps in Visual Studio before, I just clicked the wrong things this time and am trying to undo that without factory resetting this entire PC.
Does anyone have any idea how I can trigger that original prompt in Visual Studio and get a properly signed certificate to run a web application?
Upvotes: 17
Views: 58011
Reputation: 15616
Just follow these SS and re-run the project.
Upvotes: -1
Reputation: 359
Simply open the terminal:
dotnet dev-certs https --clean
dotnet dev-certs https --trust
Upvotes: 35
Reputation: 21
I had issue with SignalR client failing to connect/subscribe to localhost hub in development only, because the localhost dev cert was not a trusted root certificate; likely caused by browser security requirements.
Using 'MMC' export localhost 'ASP.NET Core HTTPS ...' cert from 'Personal Certificates' and import into 'Trusted Root Certificates'.
Upvotes: 2
Reputation: 511
If anyone has this very specific issue again, I'll post what I did to fix it (from this forum thread: https://developercommunity.visualstudio.com/t/cant-debug-aspnet-applications-err-connection-rese/1239592?viewtype=all)
1. In VS: Tools > Command Line > Developer Command Prompt, run
Edit: not needed, thanks lex-li!devenv /resetsettings
(this will also reset some customization settings)
netsh http show sslcert ipport=0.0.0.0:44390
in the command prompt (ensure the Certificate Hash field is present).Upvotes: 21
Reputation: 973
You can create a self-signed certificate using dotnet dev-certs
It'll be stored in your PC's certificate store and VS will use it when scaffolding new projects with SSL support.
Upvotes: 0