public class Startup { public Startup(IHostingEnvironment env) { Configuration = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); } public IConfiguration Configuration { get; } 读取配置信息
Configuration.GetSection("AppConfig")["DbConn"] 来源:博客园
作者:向萧
链接:https://www.cnblogs.com/dayang12525/p/11737133.html