//加载配置文件
var configurationBuilder = new ConfigurationBuilder();
//添加配置文件路径
configurationBuilder.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
//获取Url信息
var configuration = configurationBuilder.Build();
string name = configuration.GetValue<string>("API:HelperApi:Url");
return name;
标签:配置文件,Url,configurationBuilder,地址,获取,json,var,configuration From: https://www.cnblogs.com/wangtiantian/p/17791283.html