Change Default Port Number of ASP.NET App

Server Endpoints

There is a file in root folder called appsettings.json with you can change the server related configuration, this is an example with Kestrel:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://localhost:5400"
      },
      "Https": {
        "Url": "https://localhost:5401"
      }
    }
  }
}

From command line

You can run the application with the --urls parameter to specify the ports:

dotnet run --urls http://localhost:8076

References
https://stackoverflow.com/questions/70332897/how-to-change-default-port-no-of-my-net-core-6-api