ASP.NET Core projects are configured to bind to a random HTTP port between 5000-5300 and a random HTTPS port between 7000-7300. This default configuration is specified in the generated
properties/launchSettings.json file and can be overridden. More on this can be found -
Configure endpoints for the ASP.NET Core web server[
^]
Visual Studio is overriding your port. You can change VS port editing this file Properties\launchSettings.json or else set it by code:
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://localhost:80")
.Build();
host.Run();
Read this solution here -
How to change the port number for Asp.Net core app[
^]