I have mvc application (tutorial) running OK on SQL Server Express:
<add name="MusicStoreEntities" connectionString="data source=.\SQLEXPRESS;Initial
Catalog=MusicStore;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
but giving error when using another installed instance of SQL:
<add name="MusicStoreEntities" connectionString="data source=.\SQLSERVER;Initial
Catalog=MusicStore;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
Connection to sql works fine, but I don’t know how to fix this :
ERROR:
Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.
Source Error:
If you are using EF. try to add this in your dbContext
OR
drop the database and let EF recreate it itself