how to read values from appsettings.json in c# .net core 8 | Read appsettings.json Parameters

In this tutorial we are lean how to read values from appsetting file

Appsettings.json file in ASP.NET Core application is a JSON formatted file that stores configuration data.

In this file, you can keep settings like connection strings, application settings, logging configuration, and anything else you want to change without recompiling your application. The settings in this file can be read at runtime by environment like development and production.

Ex:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "ConnectionStrings": {
    "DefaultConnection": "Server=DESKTOP-21E4D9T; database=brandDB; Integrated Security=True; TrustServerCertificate=true;"
  },
  "AllowedHosts": "*"
}



Post a Comment

Previous Post Next Post