I have a webapi app made using rider and asp net core 3.1
Under the Properties folder of my project I have a launchSettings.json that seems the place to add all the information to make my app launch the way I like. Here is my launchSettings.json:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": false
},
"profiles": {
"AuthWebApi": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://0.0.0.0:5137"
}
}
}
My problem comes when I want to publish my app. Everything goes well but when I execute my dll with donet, it starts on port 5000 instead of the one I configured in launchSettings.json (5137). I guess this is because the configuration I defined takes effect only in debug. But I'm not sure.
I know I could use the url param when running my binary to make it listen on the port I want but I prefer to have all configuration in the launchsettings.json.
Is this possible? How do you handle your launch settings for a publisher app?
launchSettings.json
is used only for development environment:
The launchSettings.json file:
- Is only used on the local development machine.
- Is not deployed.
- contains profile settings.
To set up production/staging environment you can use environment variables and/or configuration files.