Entity Framework - Unable to load the specified metadata resource

前端 未结 17 1290
一生所求
一生所求 2020-12-14 15:21

I realise that this has been asked a number of times but I just can\'t seem to get the bottom of my issue. I\'m getting the following error stack:

17条回答
  •  情书的邮戳
    2020-12-14 15:35

    I actually received this identical error because my Entity Framework connection string was pointing to a valid database however it was the incorrrect database.

    If you have the following instances in SQL Server:

    • MyDatabase1
    • MyDatabase2

    Make sure that the connection string points to the same database that the .EDMX is wired up to and was generated from. Seems obvious enough, but when copying EF connection settings from 1 project to another this error was made and the net result was the Unable to load the specified metadata resource message. Once I used the correct connection string pointing to the correct database and assembly - the error was resolved.

    The easiest thing to do is take the original connection string created in the .config file residing next to the .EDMX and copy where needed to make sure subtle or minor omissions/mistakes are not made causing EF to not load/connect correctly.

提交回复
热议问题