Sujeet Raman

Sujeet Raman

  • 864
  • 927
  • 352.9k

How to read appsetting value from .net 5.0

Jun 14 2021 2:51 PM

hi i have a method to get appsetting.json value in .netcore 3.1 but i cudnt use that method in 5.0 

 string value= GetConfig("configkey");

GetConfig(configkey);{

 var configValue = Configuration[configKey];

appsetting:

//}
{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning",
      "System": "Information",
      "Microsoft": "Information"
    }
  },

 configkey:"configkey"
}

}

this is not working in 5.0 but works in 3.1 please help me

 


Answers (5)