0

I had a bunch of old/conflicting named instances of SQL Server on my machine, so I deleted them and decided to create a fresh default instance of SQL Server 2016 Express.

Which created myriad problems...

First, I tried running my migrations in my code and I got an error

Unable to Add Data Connection. Could not load file or assembly Microsoft.SqlServer.management.sdk.sfc

After a full day of searching and downloading the Shared Management Objects from the 2016 and 2014 feature packs (to no avail), I finally tried downloading it from the 2012 feature pack (as suggested in some small comment somewhere) and that did the trick - I could finally create a data connection in Server Explorer!

But now...I still cannot seem to connect to the right server. In Server Explorer, the server is listed, but no tables appear. I also cannot run my migrations. I get 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: 26 - Error Locating Server/Instance Specified)

Here is Server Explorer in Visual Studio:

(Server Explorer in Visual Studio)

This is my connection string in my app.config file:

<connectionStrings>
    <add name="DefaultConnection" 
         connectionString="data source=.\SQLEXPRESS; initial catalog=EFChallenge2; integrated security=SSPI" 
         providerName="System.Data.SqlClient"/>
</connectionStrings>

Also, SSMS connects to the server just fine. I can create databases and tables with no problem.

I named the new default instance of SQL Server Express JenProWin, the same as it was previously named. Could Visual Studio be referring to an old named instance with the same name? If so, how can I update it? (NOTE: I've already tried deleting the server and adding it again - the issue remains.)

Jenergy
  • 11
  • 3
  • Hello Jenergy, please try giving different instance name. That might help if your previous version is not uninstalled completely. – Bikswan Aug 07 '16 at 00:02
  • It ended up being a problem with the SQL Server Agent - I noticed that the service wasn't running and wouldn't start, no matter what I did. I did another full, fresh install of SQL Server and everything works perfectly now! – Jenergy Aug 09 '16 at 00:11
  • I am glad you are able to solve it. Happy coding :) – Bikswan Aug 10 '16 at 02:35

0 Answers0