launchSettings.json
Location:
Properties/launchSettings.json
Purpose:
Development-time launch configuration. Defines how the app runs when you launch it from Visual Studio, Rider, or dotnet run — including which URL, environment, and browser to use.
Example:
{
"profiles": {
"MyWebApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5000;https://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}Key facts:
- Used only by development tools.
- Controls launch-time settings, not production behaviour.
- Ignored when you publish/deploy your app (unless you explicitly export values).
- Commonly defines:
- Port numbers (
applicationUrl) - Whether to open a browser
- Environment (
ASPNETCORE_ENVIRONMENT) - Which command (
Project,IISExpress, etc.)
- Port numbers (
appsettings.json
Location:
Root of the project (same folder as Program.cs).
Purpose:
Defines your app’s configuration values — connection strings, logging, custom settings, API keys, etc.
Example:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Server=myServer;Database=myDb;User Id=myUser;Password=myPass;"
},
"AllowedHosts": "*"
}