Visual Studio 2019: "This site can’t provide a secure connection" on localhost

Just as it did not work for @Nosnetrom - repairing IIS 10.0 Express did not work for me either. As @Julian mentioned my problem was caused by uninstalling VS 2017 as well.

This is what did not work for me:

  • uninstalling / re-installing VS 2019
  • installing VS 2017
  • uninstalling / re-installing / repairing IIS 10.0 Express

This is what worked for me:

  • after reading this advice - I realized that I was using port 51542 instead of a port in the range of 44300 through 44399 enter image description here
  • then I updated the applicationhost.config file according to this advice. The location of said file on my Windows 10 machine is: C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer\applicationhost.config. I had to open that file in Notepad ran as an administrator otherwise I could not save these changes: enter image description here
  • then in Visual Studio I created a new virtual directory enter image description here
  • that seemed to have done the trick for me - when I ran the application it worked enter image description here

Repair of IIS Express fixed my problem:

enter image description here