(1)6如何读取配置⽂件appsettings.json设置字符串
{
"Logging": {
"LogLevel": {
"Default": "Information",
读取配置文件失败
"Microsoft.AspNetCore": "Warning"
}
免检车辆},黄幻
"AllowedHosts": "*",
"ConnectionStrings": {
慕容云海的扮演者
"SqlConn": "PORT=5432;DATABASE=WebApp;HOST=localhost;PASSWORD=123456;USER ID=postgres"  }
二寸照片尺寸
}
Program.cs⾥写家法惩罚
IConfigurationRoot configuration = builder.Configuration;
var conn = configuration.GetConnectionString("SqlConn");
Console.WriteLine(conn);
输出:
PORT=5432;DATABASE=WebApp;HOST=localhost;PASSWORD=123456;USER ID=postgres