Visual Studio 2015 Enterprise Breaks TCP/IP Connection to SQL Server 2008 R2, 2012, and 2014 When Running on the Same Machine RRS feed

  • Question

  • 1.  Starting with a "clean" copy of Windows 7 (I used Professional SP1), install SQL Server 2014 Developer Edition.  

    2.  Launch SQL Server Configuration Manager.  Enable the TCP/IP and Named Pipes protocols.  Make sure the SQL Server Browers service is also running.

    3.  Create a small C# or VB.NET Winforms application (I used .NET Framework 4.51) that opens a connection to a database on the server instance on the SAME BOX.  Build your SQL ConnectionString and set the "NetworkLibrary" property to "DBMSSOCN":

            With MyBuilder
                .DataSource = "MyMachine\SQLServerInstanceName"
                 .InitialCatalog = "Adventureworks"
                .IntegratedSecurity = True
                .Enlist = False
                .Encrypt = False
                .NetworkLibrary = "DBMSSOCN"
                .ConnectTimeout = 5
            End With

    3.  Install Visual Studio 2015 Enterprise on the same machine that you just installed SQL Server 2014 Developer Edition. 

    4.  Run the same Winforms application again.  When it attempts to open up the connection to the database on the SAME BOX, it will generate the following error:

    "A network -related or instance-specific error occurred while establishing a connection to SQL Server.  The server was not found or 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 have duplicated this problem using SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014.  The problem is when you use TCP/IP in your VB/NET or C# Winforms application to connect to a database on the SAME machine that the SQL Server instance is installed on.

    Master VB Guru

    Tuesday, August 11, 2015 2:39 PM