This blog post will show you how to change the HTTP port that an ASP.NET Core application uses.
This is a necessary step if you want to run your application on a different machine or server than the one it is currently running on. We will walk you through the process of changing the port number, and then show you how to test your application to make sure it is working properly.
Visual Studio \ ASP.NET Core will assign any application you create a random port number by default.
To change the port the application is using, Open the file lunchSetting.json. You will find it under the properties folder in your project and as shown below.
Inside the file, change applicationUrl port (below is set to 5000) to a different port number and save the file.
Run the application either using dotnet run or from the Visual Studio console to test the change.