在项目中又遇到一个坑,来填坑

 //配置sb
            builder.ConfigureWebJobs((h, b) =>
            {
                b.AddAzureStorageCoreServices();
                b.AddServiceBus(c =>
                {
                    c.ConnectionString = h.Configuration.GetConnectionString("acc_azure");//就是这里读取不到值
                    c.MessageHandlerOptions.MaxConcurrentCalls = 1;
                });
            });

appsetting.json

{
  "ConnectionStrings": {
    "acc_jd": "Data Source=xxxxx",
    "acc_azure": "Endpoint=sb://xxxxx;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

找到json的属性,然后改为始终复制就好了

读取不到appsettings.json的值

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2021-06-04
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
相关资源
相似解决方案