asp.net core 2.0 - Value cannot be null. Parameter name: connectionString

后端 未结 22 1929
时光取名叫无心
时光取名叫无心 2020-12-13 10:00

I had the following error in package manager console when Add-Migration

Value cannot be null. Parameter name: connectionString

22条回答
  •  被撕碎了的回忆
    2020-12-13 10:25

    I had the same issue, but my solution was a lot simpler. All I did was to change the order of the appsettings.json from:

    {
      "Message": "Hello World",
      "ConnectionStrings": {
        "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=NotMyFault;Trusted_Connection=True;MultipleActiveResultSets=true"
      }
    }
    

    to:

    {
       "ConnectionStrings": {
        "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=NotMyFault;Trusted_Connection=True;MultipleActiveResultSets=true"
      },
      "Message": "Hello World"
    }
    

    I have a suspicion that there is a sequence/order of parameters in the appsettings.json file.

提交回复
热议问题