C#C
C#14mo ago
Jiry_XD

✅ Asp .NET Core production settings.json question.

Hi all,

As you know you have an appsettings.json file.

Which contains some general things such as:
{
    "ConnectionStrings": {
        "SqlServer": "afakeconnstring, you should not store it here, overridden with usersecrets"
    },
    "Logging": {
        "LogLevel": {
            "Default": "Information",
            "Microsoft.AspNetCore": "Warning",
            "EntityFrameworkCore.Triggered": "Warning"
        }
    },
    "AllowedHosts": "*"
}


We also have a launchsettings.json file
{
  "profiles": {
    "https": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "dotnetRunMessages": true
    }
  }
}


In production when we publish our app, what is the default running environment?
How do I set the ASPNETCORE_ENVIRONMENT to "Production" in production?
How do I set a seperate ConnectionString_SqlServer for production?

Does the published production build have these .json files or do they rely solely on the HOST environment variables?
Was this page helpful?