Ritu

Ritu

  • 1.4k
  • 348
  • 43.5k

how to get values from appsettings.json

Nov 3 2022 1:35 PM

I'm working on .net core api and need to get values from appsettings.json 

 

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "IIS Express": {
    "commandName": "IISExpress",
    "launchBrowser": true,
    "environmentVariables": {
      "ASPNETCORE_ENVIRONMENT": "Development",
      "projectList": "Project",
      "projectCatList": "Project Categories",
    }
  }
}

 

I want to access these vaues in controller class and another .cs class


Answers (5)