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?

Answers


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.

https://msdn.microsoft.com/en-us/data/jj591621.aspx?f=255&MSPPError=-2147217396#idempotent

Post Status

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

Search




Leave an answer