ASP.NET MVC4 Code First - 'Cannot attach the file as database' exception

后端 未结 4 923
独厮守ぢ
独厮守ぢ 2020-12-21 03:58

I\'m using Code First concept in Entity Framework and I\'m constantly getting the following exception while starting application:

Cannot attach the file \'C:         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-21 04:25

    I just got into the same problem, and yet the answers above helped, the solution was different.

    In my case, I was reusing a project that has already created it´s database. And since the name in the config was the same, it was throwing the exception, missleading the real solution.

    It worth checking the database is not created and is different than the ones you used before. Change the name and go ahead.

提交回复
热议问题