26
05/21
dotnetCore利用Configuration读取自定义配置文件
在appsettings.json中: { "Logging":{ "LogLevel":{ "Default":"Warning" } }, "Name":"Cas.Api", "AllowedHosts":"*", "urls":"http://0.0.0.0:8080", "ConsulUrl":"http://127.0.0.1:8500", "ConnectionStrings":{ "DefaultConnection":"server=192.168.2.100;port=3306;database=dati;user=root;password=888888.;CharSet=utf8;" }, "appid":"wx*******", "secret":"xxx*********" } 在controller中: private readonly IConfiguration _configuration; publicAppController(IConfiguration configurati...