I'm trying to deploy a database to a Windows Server machine.

The database is a SQL Server LocalDB. When I deploy it to a Windows machine, everything works correctly. When I try to deploy the same database, but to a Windows Server machine, everything is also ok, DB is created, but when I try to work with this database (Get account user data), I got an error:

Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration."

I guess changing AutomaticMigrationsEnabled to true is not a solution, as after trying to make it I got the other errors.

Also, when I use SQL Server Express Database, everything works without any issues. The issue is only when I use LocalDB together with a Windows Server.

Are there any ways to solve this issue?

  • What do you use to migrate?
    – Peter
    Dec 6, 2022 at 12:01
  • @Peter Entity Framework. Code first migration. The error is got during processing my overridden GrantResourceOwnerCredentials method. Dec 6, 2022 at 12:05
  • Why use LocalDB and not just SQL Server Express itself?
    – J.D.
    Dec 6, 2022 at 13:25
  • @J.D. I'm using SQL Server Express, but also want to use LocalDB on purpose Dec 6, 2022 at 13:51
  • I understand that, but why LocalDB?...what is your goal that you think you need it in addition to just SQL Server Express itself?
    – J.D.
    Dec 6, 2022 at 14:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.