liveBook · Manning

launchSettings.json

As explained in Pro ASP.NET Core 7, Tenth Edition

launchsettings.json is a .NET project configuration file that defines launch profiles, including application URLs, ports, and environment variables.

The Properties/launchSettings.json file holds settings for starting an ASP.NET Core application. Its launch profiles specify listening URLs, environment variables, and whether to open a browser. Edit it when you need a predictable local port or startup environment. section 15.2.5 section 32.1

{
 "iisSettings": {
   "windowsAuthentication": false,
   "anonymousAuthentication": true,
   "iisExpress": {
     "applicationUrl": "http://localhost:5000",
     "sslPort": 0
   }
 },
 "profiles": {
   "Platform": {
     "commandName": "Project",
     "dotnetRunMessages": true,
     "launchBrowser": true,
     "applicationUrl": "http://localhost:5000",
     "environmentVariables": {
       "ASPNETCORE_ENVIRONMENT": "Development"
     }
   },
   "IIS Express": {
     "commandName": "IISExpress",
     "launchBrowser": true,
     "environmentVariables": {
       "ASPNETCORE_ENVIRONMENT": "Development"
     }
   }
 }
}

Compare the project profile with IIS Express: each has its own settings. For dotnet run, change the project profile’s applicationUrl; changing only iisSettings will not set that command’s port. section 15.2.5 section 2.3

For a local run:

  • Set the project profile’s applicationUrl to http://localhost:5000, run dotnet run from the project folder, then request that URL in a browser. section 2.3
  • Set ASPNETCORE_ENVIRONMENT under environmentVariables when you need a different environment. Development selects appsettings.Development.json during startup; the setting can also be inspected through application configuration. section 15.2.5
  • To listen on HTTP and HTTPS, use an applicationUrl such as http://localhost:5000;https://localhost:5500. Separate URLs with a semicolon and no spaces; the HTTPS example also regenerates and trusts a development certificate. section 16.4.1

Watch which launcher you use. IIS Express has separate settings, while a Visual Studio Code launch configuration sets ASPNETCORE_ENVIRONMENT in .vscode/launch.json. If an environment change appears ineffective, check the configuration used to start the application. section 15.2.5

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Explains profile sections, port selection, environment-variable effects, and HTTPS URL syntax, without detailing launch-file processing internals.
Examples
Uses localhost:5000, a Production environment edit, and a two-URL HTTP/HTTPS profile as concrete configurations.
What it assumes
Assumes an ASP.NET Core project and a way to run it; introduces the launch-profile structure before using its settings.
What you can do after
Operate/configure it to select local listening URLs, startup environment, and browser-launch behavior.
How it connects
Connects launch profiles to dotnet run, IIS Express, ASPNETCORE_ENVIRONMENT, appsettings.Development.json, HTTPS, and Visual Studio Code launch.json.

Also explained in

Compare how 4 books explain launchSettings.json →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.