App Settings .Net Core

后端 未结 2 1854
自闭症患者
自闭症患者 2021-01-17 05:15

I am trying to add an appsettings.json and followed a lot of tutorials and still can not do it.

I create appsettings.json

{
  \"option1\": \"value1_f         


        
2条回答
  •  醉话见心
    2021-01-17 05:39

    Make sure that you imported everything that is necessary and have the required packages installed. Then you can do the following

    services.Configure(options => Configuration.GetSection("options1").Bind(options)); 
    

    this will cause the options to be updated at runtime whenever you change the appssettings programatically.

提交回复
热议问题