Using Kestrel you can specify port using next approaches:
Defining ASPNETCORE_URLS environment variable.
Windows
SET ASPNETCORE_URLS=https://0.0.0.0:5001
OS X
export ASPNETCORE_URLS=https://0.0.0.0:5001
Via command line passing --server.urls parameter
dotnet run --server.urls=http...