Why does aspnet core start on port 80?
Why does aspnet core start on port 80?
376
06-Jul-2023
Updated on 07-Jul-2023
Aryan Kumar
07-Jul-2023ASP.NET Core does not always start on port 80. By default, 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.jsonfile.However, if you want ASP.NET Core to start on port 80, you can specify this in the
launchSettings.jsonfile. For example, the following code will configure ASP.NET Core to start on port 80:JSON
Once you have made this change, you can start ASP.NET Core by running the following command from the command line:
Code snippet
ASP.NET Core will now start on port 80.
The reason why port 80 is often used for ASP.NET Core applications is because it is the default port for HTTP traffic. This means that if you want your ASP.NET Core application to be accessible to the internet, you can simply point your browser to
http://localhost:80.However, it is important to note that port 80 may already be in use by another application on your computer. If this is the case, you will need to choose a different port for your ASP.NET Core application. You can do this by editing the
launchSettings.jsonfile as shown above.