1

I have a local SQL Server database setup on a Dell R720 running Windows Server 2012 R2 and I am developing an ASP.NET site. I am able to connect to the database and pull in objects and queries and everything EXCEPT when I try to pull in the login tool.

I was following a tutorial on creating a login page and they suggested pulling in this tool, and clicking the login button which will prompt visual studio to create a new database with a bunch of tables in it, which they did successfully in the video but when I try it, I get this response:

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 my web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <connectionStrings>
        <add name="SOSiQConnectionString" 
             connectionString="Data Source=KINGDOM_NETWORK;Initial Catalog=SOSiQ;Integrated Security=true;"
             providerName="System.Data.SqlClient" />
        <!-- commented this out testing the connection
        <add name="SOSiQConnectionString1" 
             connectionString="Data Source=localhost\;Initial Catalog=SOSiQ;Integrated Security=True"
             providerName="System.Data.SqlClient" /> -->
    </connectionStrings> 

Visual studio code showing SQL Server database connection

PS, I have searched google for days looking for a solution. Everybody suggests making sure that you have remote connections enabled and firewall/ports. I've done all that to no avail, but, in my mind it shouldn't matter because A. I am on the machine that has the SQL Server database and B. I can access the database from my project in Visual Studio.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for `Data Source=`) of either `.` (just a dot), or `(local)` (including the parenthesis), or `localhost` (but **without** the trailing backslash that you have in your second connection string) – marc_s Dec 30 '18 at 22:12
  • Please follow all these steps mentioned [here](https://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/) & if still you have same problem then to connect sql using IP – Sushil Jadhav Dec 31 '18 at 06:23
  • Marc and Sushil thank you i will try both of those and let you know. – Truth is a person Dec 31 '18 at 21:56
  • So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project. – Truth is a person Jan 01 '19 at 01:26
  • Maybe this will help clarify? https://www.reddit.com/r/homelab/comments/abecew/aspnet_login_control_not_working_in_visual_studio/ – Truth is a person Jan 01 '19 at 03:12
  • So guess what! I downloaded and installed Sql server express (i already had sql server enterprise!?) and boom it worked... – Truth is a person Jan 01 '19 at 08:55

1 Answers1

0

Download SQL Server Express, even if you have a Standard or an Enterprise version already.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459