Entity Framework + LocalDB Connection String Changes

Apparently there was a change in how you connect to SQL Server LocalDb after version v11. I ran into this when I used some old code still configured for version 11. I received this error:

“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: 50 – Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.”

I realized the version specified in my config was older than the version I’m actually using LocalDb 2014 and 2016 that came with Visual Studio 2015.

As you can see in my installed programs and features list, I’m clearly running the newer version.

In order to fix the issue, I simply had to change my connection factory’s parameter from “v11.0” to “MSSQLLocalDb”.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s