An error occurred while getting provider information from the database

connection-string ef-migrations entity-framework


Receiving an error:

System.Data.ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string.
Check the inner exceptions for details and ensure that the connection string is correct.
---> System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

When attempting to execute an, I consistently get anAdd-Migration

I need to connect to my local SQL server, NOT SQLEXPRESS, thus this is my connection string.

    <add name="ReaderInsightDbContext" 
         connectionString="data source=localhost\MSSQLSERVER;
                         initial catalog=ReaderInsight;Integrated Security=True" 
         providerName="System.Data.SqlClient" />

My database is here:

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA

So MSSQLSERVER is my instance. I'm not sure what's happening. This started occuring when I altered my code to utilize the UOW pattern, after it had first functioned well. In addition, I switched from EF 4.3 to EF5. same problem

Here are some examples of the several data source configurations I tested without success:

  • localhost\MSSQLSERVER
  • //localhost\MSSQLSERVER
  • (local)\MSSQLSERVER

If I type.SQLEXPRESS, it executes.

10/23/2013 9:46:59 AM

Popular Answer

I was able to fix the problem.

Bottom line: There are problems when the migration files are manually deleted.

I checked that my connection string looks as follows:

    <add name="ReaderInsightDbContext" 
     "Data Source=(local);Initial Catalog=ReaderInsight;Integrated Security=True"
     providerName="System.Data.SqlClient" />

carried out anUpdate-Database -TargetMigration:$InitialDatabase This was ineffective since it indicated that modifications were still pending.

Therefore, I did.

  new System.Data

in the file global.asax.

So that it won't run again, I commented it out. When I ran Update-Database after doing an Add-Migration Init, it flawlessly reproduced the script for the full database.

10/23/2013 9:49:45 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow