Home Ask Login Register

Developers Planet

Your answer is one click away!

user3338734 February 2016

I get this error on my production server, but the application works locally just fine

Migrations is enabled for context 'ApplicationDbContext' but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.

Can anyone explaing why?


Steve Greene February 2016

If your dev system is working and prod is not, you can generate a script to bring them back in sync:

update-database -Script –SourceMigration $InitialDatabase

This will create an idempotent script that will test what has been applied and what hasn't. Now use SQL Server Management Studio to apply that script.


Post Status

Asked in February 2016
Viewed 3,066 times
Voted 9
Answered 1 times


Leave an answer

Quote of the day: live life