Net Core 读取json文件
2021-05-29 21:02
标签:current 常见 baseurl col pre cto conf TBase url 一种是网上常见的一种 另外一种是 Net Core 读取json文件 标签:current 常见 baseurl col pre cto conf TBase url 原文地址:https://www.cnblogs.com/ZkbFighting/p/14701518.html var builder1 = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
var configuration = builder1.Build();
string baseUrl = configuration.GetSection("ConnectionStrings:xxx").Value;
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
//.AddEnvironmentVariables()
.Build();
Configuration = config.GetSection("ConnectionStrings:xxx");
下一篇:golang-web参数校验