1

In VS Code, I'm trying to host an ASP.NET MVC app. I hit "F5" in order to run the debugger, and VS Code automatically opens my default browser, which is Brave. I get the following error on Chrome and Brave: Vague Browser Error I know that hosting is taking place, because of this debugger info from VS Code.

The local site hosting works well on Firefox, but not on Chrome and Brave. When it worked on Firefox, it prompted me to continue to the site despite the danger. I told it "I understand the risks, please continue", and boom, it worked on Firefox.

I noticed that http://localhost:5000 redirects to https://localhost:5001, which made me think that there was a certificate error. I deleted the default SSL certificate for localhost in Brave, and then in VS Code, I restored it using: dotnet dev-certs https dotnet dev-certs https --trust

In Chrome and Brave, I tried https://127.0.0.1:5001, and I was given the same prompt that I was given in Firefox, and then it worked after I told the browser "I understand the risks, please continue".

So though I found a workaround, it's very annoying to have to type in the loopback address rather than just let VS Code automatically open the browser. Can someone tell me how I can use localhost on Brave and Chrome?

Matt C
  • 11
  • 4
  • If you have Edge, try setting it as the default browser, and once it comes around, copy the URL and paste it into the chrome address bar. The inbuilt IIS Express seems to have trouble starting with chrome. – Venugopal M Jan 19 '21 at 17:01
  • I did that, and got a slightly different, but similar error. Edge told me "The connection was reset." I tried in IE, and got the error message, "Can’t connect securely to this page". So it looks like neither Chrome, IE, Brave, nor Edge can do it. – Matt C Jan 19 '21 at 22:27
  • Hmm, it's been over a week. Does no-one on StackOverflow know the answer to this problem? – Matt C Jan 23 '21 at 23:28
  • It's so fun commenting with myself... I guess this site is at least useful as a diagnostic log... – Matt C Feb 12 '21 at 12:05
  • https://stackoverflow.com/questions/25277457/google-chrome-redirecting-localhost-to-https?rq=1 This solution did not work. Chrome and Brave are still unable to connect to that port on localhost. – Matt C Feb 12 '21 at 12:06
  • I found that IIS was not enabled on my system, so I enabled it. Not sure why I can access the loopback without IIS enabled, since IIS is required for ASP.NET. But that did not solve the problem. – Matt C Feb 12 '21 at 12:37
  • I added a self-signed certificate in the IIS manager. I gave it the friendly name "localhost" and it was for "web hosting" and not "personal". Deleted that cert, tried it again using "personal". No joy. – Matt C Feb 12 '21 at 12:49

0 Answers0