您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

22 行
857 B

  1. using Microsoft.Extensions.Configuration;
  2. using Microsoft.Extensions.Configuration.Json;
  3. using System;
  4. namespace DataVAPI.AppConfig
  5. {
  6. public class AppConfigurtaionServices
  7. {
  8. public static IConfiguration Configuration { get; set; }
  9. static AppConfigurtaionServices()
  10. {
  11. //ReloadOnChange = true 当appsettings.json被修改时重新加载
  12. Configuration = new ConfigurationBuilder()
  13. //.SetBasePath(Directory.GetCurrentDirectory())
  14. //AppDomain.CurrentDomain.BaseDirectory是程序集基目录,所以appsettings.json,需要复制一份放在程序集目录下,
  15. .SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
  16. .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
  17. .Build();
  18. }
  19. }
  20. }