Home > Mobile >  Entity framework core, Keyword not supported: 'server:(localdb)\mssqllocaldb;database'
Entity framework core, Keyword not supported: 'server:(localdb)\mssqllocaldb;database'

Time:08-24

I am using .net 6 and EntityFrameworkCore Version 6.0.8. I made a migration and tried to update database with updata-database command in Package manager console but the following exception is thrown: System.ArgumentException: Keyword not supported: 'server:(localdb)\mssqllocaldb;database'. This is my connection string in the appsettings file: "Server=(LocalDB)\MSSQLLocalDB;Database=Bulky;Trusted_Connection=True;" enter image description here

and this is my program.cs file: enter image description here

What might be the problem?

CodePudding user response:

According to the error, the connection string returned from your configuration is messed up, and looks something like

"server:(localdb)\mssqllocaldb;database= . . ."

Which parses all of server:(localdb)\mssqllocaldb;database as a single Keyword.

.NET Core configuration can load from multiple locations, so your appSettings.json may not be the source of the configuration value.

  • Related