4

I am using EF Code First (.NET 4.5 + VS2012). My project was creating and using LocalDB correctly. I have SQL Server Express also installed on my machine (2008R2). I didn't change any configuration yet it switched to using SQL Server Express.

I have now stopped my SQL Server instance and whenever I try to rebuild the database using Update-Database I get the following message:

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: 26 - Error Locating Server/Instance Specified)

My configuration file has the following EF configuration:

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v11.0" />
  </parameters>
</defaultConnectionFactory>

Any advice? I'd prefer to be using Localdb rather than SQL Server Express.

2
  • LocalDB is special version of SQL Express. Aug 28, 2012 at 8:30
  • @LadislavMrnka Yes, but the database is being created in my SQL Express instance, not my Localdb instance.
    – Sam
    Aug 28, 2012 at 8:52

1 Answer 1

4

What it turned out to be, for some reason the GUI app.config referenced SqlConnectionFactory not LocalDbConnectionFactory. Fixing this up solved it.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.