Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Doesn't update database #6

Open
hughgallagher opened this issue Sep 20, 2016 · 5 comments
Open

Doesn't update database #6

hughgallagher opened this issue Sep 20, 2016 · 5 comments

Comments

@hughgallagher
Copy link

hughgallagher commented Sep 20, 2016

How come these simple Visual Studio projects hardly ever run out of the box :) ... .Never fails to astound!

When I run the Update-Database I get the following error:-

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.

This is on windows 10 on a new install of visual studio 2015 community.

Is it something to do with localDB?

@MattSpeakman
Copy link

Have you added the query string to your configuration file. If so does it match your own configuration?

@VeronicaWasson
Copy link
Owner

VeronicaWasson commented Sep 22, 2016

Sounds like a LocalDB problem? Do you have SQL Server 2012 Express LocalDB? (Download here)

@silviumihaipreda
Copy link

Got the same error, because i had sql server 2014 installed, but i fixed it by changing the web.config conn string to:
<add name="BookServiceContext" connectionString="Data Source=(mssqlserver)\v12.0; Initial Catalog=BookServiceContext-20140613003603; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|BookServiceContext-20140613003603.mdf" providerName="System.Data.SqlClient"/>
It now throws this:

update-database -verbose
Using StartUp project 'BookService'.
Using NuGet project 'BookService'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.ArgumentException: Invalid value for key 'attachdbfilename'.
   at System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup)
   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)

etc

@XinCai
Copy link

XinCai commented Nov 21, 2016

Same issue for me.

when execute Update-Database , it gave me error msg :

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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)

@MattSpeakman
Copy link

You need to update the query string

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants