I have a solution with an ASP.NET MVC web project and an Infrastructure
(DAL) project. I have the following connection string in both config files:
<connectionStrings>
<add name="MyContext"
connectionString="Data Source=localhost;Initial Catalog=MyDB;User Id=dbuser; Password=WS7jHVNKTT20J7HxsG9odv1Uqf5CUu; Multipleactiveresultsets=True;Application Name=EntityFramework;"
providerName="System.Data.SqlClient" />
</connectionStrings>
I set up the user in SQL Server 2014 Management Studio with the right privileges. I installed Entity Framework and enabled migrations for the infrastructure project and created the database to begin with, but have since messed it up.
I changed the model too much, and my migrations eventually failed. So when all else failed I completely removed the migrations folder and deleted the database from the management studio (mind you there were no data yet). I did this hoping I could just retrace my steps, and I have up until the database-update
command. I now get this error constantly:
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 all of the solutions to this question, but they did not make sense to me as it was all still on localhost (see connection string).
I am at my wits end, can someone please enlighten me to my mistakes?