In Visual Studio 2022 and .net core 8 using the Properties/launchSettings.json worked best for me.
For dockerized applications this section is generated: enter image description here
Adding httpPort
and sslPort
worked like a charm:
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTP_PORTS": "8080"
},
"httpPort": 8082,
"sslPort": 8083,
"useSSL": true,
"publishAllPorts": true
}