1添加redis时,在控制台程序可以运行,而在webapi无法运行,同样代码在家里电脑可以
可能是网络设置的问题
2获取appsetting的值
2.1 builder.Configuration["Redis:Host"];
2.2 builder.Configuration.GetSection("Redis:Host").Value
2.3 获取ConnectionStrings的值 builder.Configuration.GetConnectionString("Conn"); 也可以Configuration["ConnectionStrings:Conn"];
标签:项目,builder,遇到,Redis,Host,ConnectionStrings,net6,Configuration From: https://www.cnblogs.com/carlpeng/p/17158474.html