private static string GetCustomSettings(string key) { var config = new ConfigurationBuilder() .AddInMemoryCollection() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); return config.GetSection("CustomSettings").GetValue(key, string.Empty); } // 获取自定义value public static string WXWarningClosedTemplateID => GetCustomSettings("xxx");
.net core获取appsettings CustomSettings
猜你喜欢
转载自www.cnblogs.com/LTEF/p/10334095.html
今日推荐
周排行