public class HomeController : Controller { private readonly ILogger<HomeController> _logger; private readonly IConfiguration _configuration; private AppOptions _options; public HomeController(ILogger<HomeController> logger, IConfiguration configuration, IOptionsMonitor<AppOptions> appOptions) { _logger = logger; _configuration = configuration; _options = appOptions.CurrentValue; } public IActionResult Index() { string Name = _configuration["TestSetting"]; string Name2 = _configuration["db:connection1"]; ViewBag.Name = Name; ViewBag.Name2 = Name2; return View(); } }
到此这篇关于.NET5修改配置不重启自动生效的文章就介绍到这了,更多相关.NET5修改配置不重启自动生效内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章: