.net core 获取 配置文件appsetting

 program里,通过以下方式拿到appsettings.json里的配置

修改了默认的webroot路径

string wwwroot= new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true }).Build().GetValue("AppSettings:wwwroot");
                
                CreateWebHostBuilder(args).UseWebRoot(wwwroot).Build().Run();

 

你可能感兴趣的:(.net core 获取 配置文件appsetting)