4
Answers

A network-related or instance-specific error

Hi all,
 
I got an error like this when i'm gonna run asp.net web forms
 
why is that? How should i prevent this error.
 
Server Error in '/' Application.
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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)
Source Error:
Line 85:
Line 86:
Line 87: con.Open();
Line 88: string pcount = Convert.ToString(command.ExecuteScalar());
Line 89: if (pcount.Length == 0)

Answers (4)

0
Photo of Mangesh Gaherwar
NA 4.1k 70.9k 7y
check if u have configured ur sql server in connection string properly
 
 if it is local sql server check if the sql server process is up and running
 
 
Accepted
0
Photo of Sagar Bandkar
NA 190 9.4k 7y
first connect database using connectionstring credentials.if it will connect then check connection string.
 
Connection string ex:-
Data Source=DBIP; Initial Catalog=databaseName;User ID=DBusername;Password=DBPassword" 
0
Photo of Dharmraj Thakur
NA 4.1k 61.7k 7y
Please show me your connection string
0
Photo of Sagar  Pandurang Kap
NA 2.7k 7.6k 7y
Hi,
1) Check your internet connection whether it is working fine or not.
2) Check your connection string - in all probability it does not reference the SQL server instance correctly.