For some very strange reason when I was issuing the "Update-Database" command in the Package Manager Console I was getting 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)
If I was running my application through the Console / Unit test it was working fine and creating the database and applying data migrations.
PM> update-database -verbose
Provided the clue!! Data migration was strangely connecting to .\SQLEXPRESS "(DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Configuration)."
This clue made me curious on why this was happening even though the connection string and app config were both correct.
The solution was:
Strangely the start up project was set to another DLL project and even though in the Package Manager Console I was selecting my Data project and issuing the Update-Database command it was trying to get the connection string from the startup project that even didn't have any connection string at all.
Just some silly error that can cause you headaches!!!!
Popular Posts
-
Kendo UI applying SUM in footer template kendo ui - KendoUI: Grid Summary values in Footer - Stack Overflow : ", footerTemplate:...
-
MVC grid example ASP.NET MVC Flexigrid sample - CodeProject : 'via Blog this'
-
A possible way of handling distributed transaction for multiple contexts without alleviation to MSDTC??? c# - Entity Framework - Using Trans...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment