Reputation: 4014
Okay so a lot of people have posted a similar question, however I don't seem to be able to find a solution to my problem in any of them. So this is my situation.
Yesterday I was working with my SQL Server Express through SQL Server Management Studio. I close my projects as I've done multiple times before and then this morning when I tried to connect again with the tool is gives me this error:
TITLE: Connect to Server
Cannot connect to .\SQLExpress.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
I think my main question here is if there is a solution to this problem, or if I have to install SQL Server Express all over again?
PS: Here are some system stats. I'm working on a Windows 10 machine, and the SQL Server Management Studio version is 2014.
Upvotes: 6
Views: 35387
Reputation: 51
this issue also confusing me a few days after the IT guy do some security settings to the SQL Server. i have an EntityFramework for the Web application and a desktop application. after i did some setting on the SQL Server, the Web application comeback to work, but the desktop still with issue. but i used the some connection string for the both application, it make no sense one is work but the other doesn't. then i searched a lot until i found some one said need add a port number 1433 after the $ServerName$DatabaseInstanceName,1433 at here http://www.windows-tech.info/15/9f6dedc097727100.php . after i added it. the exception became: System.Data.SqlClient.SqlException: Login failed for user 'domain\name-PC$'. then i found this link System.Data.SqlClient.SqlException: Login failed for user : System.Data.SqlClient.SqlException: Login failed for user it said need add Trusted_Connection=False;. the whole connection string should be like: data source=XXXXX\SQLSERVER,1433;initial catalog=XXXDB;user id=UserID;password=PWD;Trusted_Connection=False;MultipleActiveResultSets=True;
hope this answer will help the ones out off Generic exception: "Error: 26-Error Locating Server/Instance Specified)
Upvotes: 0
Reputation: 7059
I had the same problem but a different solution. My protocols was configured correctly but I was still getting the problem. In SQL Server Configuration Manager make sure that the SQL Server Browser is configured to start automatically and is running. As soon as the service was active my problem disappeared.
Upvotes: 0
Reputation: 8865
Open SQL Server Configuration Manager
Click on SQL Server Network Configuration
and click on Protocols for Name
Right click on TCP/IP
(make sure it is Enabled), click on Properties
Select IP Addresses
Tab and go to the last entry: IP All
Enter TCP Port 1433
.
Now restart "SQL Server .Name." using services.msc
(winKey + r)
Upvotes: 8