简体   繁体   中英

Update-Database command giving error in establishing connection to the server (Code First Migration)

I created this project on my another system and completed. I used code first migration for creating database. On that system, this app was running correctly.

But now when I had transferred the project to another system, Its package manager is showing the following 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: 26 - Error Locating Server/Instance Specified)

I tried with Update-Database -Vebrose , I observed that it is targeting wrong data source, which was in that system where I created the project. How to solve this issue?

Check if the app.config has the connection string set. It may have the connection of the "old" machine that is now unaccessible.

Is the SQL Server configured to allow remote connections? Is the port 1433 (the SQL Server default port) open?

If you only have the text you sent in the web.config, the connection string might be elsewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM