Error when updating DB: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

前端 未结 4 1858
闹比i
闹比i 2021-01-18 08:11

I\'m using EF6 and have been making a few changes to my model. Now all the sudden I get the following error when trying to update my database through the nuget command U

相关标签:
4条回答
  • 2021-01-18 08:50

    Follow step by step: 1./ Create right connect to database in web.config 1./ Right click -> select "Set as default project" 2./ run update-database againt

    That's fix.

    0 讨论(0)
  • 2021-01-18 08:51

    An error like this can happen if you have multiple projects in the solution. Run update-database - Verbose and ensure that the default project in the package manager console and the StartUp project in the solution explorer are set to the project which contains the code migrations.

    0 讨论(0)
  • 2021-01-18 08:59

    Thats caused when your migrations project is not the StartUp project, which means you'll need to set the connectionstring in the StartUp project for it to work correctly.

    Hope it helps. Best Regards.

    0 讨论(0)
  • 2021-01-18 09:05

    I had the same problem, In my case the connection string is being read from the web project not the EntityFramework project, so i made the my Web project the Solution StartUp project so the Package Console Manager can read the connection string, and in Package Console Manager i choosed EntityFramework project as Default project.

    0 讨论(0)
提交回复
热议问题