Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Trying to connect to my SQL Server but i am keep getting 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) (.Net SqlClient Data Provider)



This is my Connection String
<connectionStrings>
 <add name="myDB"
      providerName="System.Data.SqlClient" 
      connectionString="Server=Usman-PC\SQLExpress; Database=myDB; Integrated Security=True;"/>
</connectionStrings>


I have google for solution and tried many things but keep getting this error.
I was developing accounts app and now it is time for deployment on production server. Please Help me some Body.

Below is my settings
Computer name: Usman-PC
WorkGroup: USMAN-SERVER
Ip address: 192.168.0.1

Server Name: Usman-PC\SQLExpress
Instance Name: SQLEXPRESS

What I have tried:

I have looked at connection setting in Server Properties and they are good.
I also have checked and server is running.
I also have enabled TCP/IP and set the port to 1433.
I also have added new rule for port 1433 in firewall.

I am also able to transfer files between both computers.
Posted
Updated 15-Feb-18 11:36am
Comments
j snooze 15-Feb-18 17:00pm    
if you open your SQL Server configuration Manager on USMAN-PC and look at the services is the SQL Server Browser service running?

1 solution

Start with the connection string: it's very unlikely to work, particularly for remote connections where integrated security is not usual - it's normally cross domain for remote requests and that means the integrated security will probably fail. You need to set up an SQLuser and password combination wth approriate permissions from the DB.
See here: Simple SQL Connection String Creation[^] and see if it works on your client machine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900