'.NET 6.0 Razor Pages unable to connect to the localhost

I am working through some tutorials on Razor Pages using .NET 6.0 and have found that my computer is not wanting to find the localhost when running the application. If I create a basic .NET Core Web App using .NET 5.0 then everything works but if I do the same with .NET 6.0 then it doesn't load, even without any changes.

The message I receive is: This localhost page can’t be found No webpage was found for the web address: https://localhost:7273/ HTTP ERROR 404

I can open the same project on another computer and everything works as expected. I assume there is something with local setup that is causing this since the standard template for a .NET Core Web App using .NET 6.0 won't even work.

I have attempted to install the .NET Core 6.0 SDK, the Core Runtime, and the Desktop Runtime and nothing changed.

My launch settings file is: LaunchSettings.json Image And my Program.cs is: Program.cs Image

I've spent hours searching various forums but there seems to be very little available for .NET 6.0 and nothing seems to hit what I need, especially since the default starter template for a .NET Core Web App won't even work.



Solution 1:[1]

I was finally able to find another post that actually matched the issue I was having. The post can be found here: .NET 6 Core Web App Returns web page not found

I was able to confirm that building through dotnet build in the command line did work but I would have to do that every time I made a code change. I then updated visual studio and it works now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 trlatimer