首先在主目录下建立:Iyibank.Web.json文件

里边的内容如下:

{
"ConnectionStrings": {
"RedisCache": "127.0.0.1:6379"
}
}

在其他需要调用RedisCache的地方调用如下:

var builder = new ConfigurationBuilder().AddJsonFile("Iyibank.Web.json", optional: false, reloadOnChange: true);
var configuration = builder.Build();
var con= configuration.GetConnectionString("RedisCache");

相关文章:

  • 2021-07-13
  • 2022-02-13
  • 2021-11-10
  • 2019-05-31
  • 2021-09-02
  • 2022-12-23
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
相关资源
相似解决方案