Some time ago I wrote a blogpost on how to set/change port number for a solution using IIS Express and Visual Studio. After more and more projects are using .NET Core, the way of handling the port number have changed.
If you are not in .NET Core, the old solution is the way to go. But if you want to change the port in a .NET Core project, it is now a much simpler way of doing it.
In your project, at least for newer .NET Core-solutions, you should have a launchSettings.json file. What you have to do is to change the applicationUrl field.
First, figure out the location of your file. Inside your .NET Core project, there will be a folder named "Properties". Inside that folder, the launchSettings.json-file is placed. In my test-project, it does not contain much, but everyone should at least have this applicationUrl setting:
And this will show in your browser the next time you run your solution:
And do not be nervous for making problems for your production environment or something like that, the launchSettings.json is only used by your local development machine.