ASP.NET Core Interview Question #16

What is appsettings.json?

ASP.NET Core Fundamentals Junior Beginner

Quick Interview Answer

appsettings.json is a conventional JSON configuration file used by ASP.NET Core applications. It commonly stores logging settings, connection-string names, application options, and other non-secret configuration.

Detailed Explanation

appsettings.json is a conventional JSON configuration file used by ASP.NET Core applications. It commonly stores logging settings, connection-string names, application options, and other non-secret configuration.

Environment-specific files such as appsettings.Development.json can override base settings. Sensitive production secrets should not be committed to source control in appsettings.json; use secure environment or secret-management mechanisms instead.

Code Example

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=...;Database=...;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    }
  }
}