读取不到appsettings.json的值

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

 //配置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的属性,然后改为始终复制就好了

 

posted @ 2020-12-11 09:48  ProZkb  阅读(567)  评论(0编辑  收藏  举报