Discover how to fix SQL Server Error 26: Error Locating Server/Instance Specified. Our SQL Server Support team is ready to assist.
Fix SQL Server Error 26: Error Locating Server/Instance Specified
If you encounter the following message while attempting to connect your application to a SQL Server instance, you are in the right place!
SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified
SQL Server Error 26 is a common, network-related error that indicates the client application is unable to locate the SQL Server instance it’s trying to connect to. Although it can be alarming, this error is usually due to configuration or connectivity issues that are easy to resolve.
Today, we will walk through the common causes of Error 26 and offer step-by-step solutions to get your database connection back on track.
An Overview:
What Causes SQL Server Error 26?
Here are the most common reasons why Error 26 occurs:
- A typo or incorrect instance name in the connection string.
- The SQL Server service is stopped or failed to start.
- The SQL Server instance is not configured to accept remote connections.
- Ports used by SQL Server (TCP 1433 and UDP 1434) are blocked.
- SQL Browser service is not running.
- DNS problems, unreachable servers, or blocked client IPs.
- Conflicts on the network can confuse the SQL client.
If you’re getting a slightly different connection error, like SQL Server Connection Failed – SQLState 08001, this detailed guide may help.
Solution 1. Verify Server and Instance Names
Let’s start with the basics:
- Check for typos in the server and instance name in your connection string.
- If connecting locally, use `.\SQLEXPRESS` or `localhost\SQLEXPRESS` as the server name.
- If connecting remotely, ensure the server is reachable via DNS and can be pinged.
- Also, make sure the SQL Server Browser service is running. This service helps locate named instances.
Here is an example connection string:
Data Source=.\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=True
Copy Code
Solution 2. Configure Firewall and Network Access
When connecting from another machine (e.g., from Machine A to Machine B), take the following steps on the SQL Server machine (Machine B):
- First, start the SQL Server Browser service (`services.msc`).
- Open the following inbound firewall ports:
- UDP 1434 – Used by SQL Browser.
- TCP 1433 – Default SQL Server port for connections.
- In SQL Server Configuration Manager, enable the TCP/IP protocol.
These changes make sure the server is discoverable and reachable on the network.
Solution 3. Check DNS Resolution and SSRP Communication
Error 26 is more likely to appear when connecting to named instances. SQL Server clients send a SQL Server Resolution Protocol (SSRP) request to port UDP 1434 to discover the instance configuration. If the DNS is misconfigured or the SSRP response is blocked, the client cannot connect.
To troubleshoot:
- Ensure DNS is resolving correctly.
- Confirm the SQL Browser service is running.
- Whitelist `sqlbrowser.exe` and UDP port 1434 in the firewall.
- Use a tool like PortQry to check the SSRP response:
portqry -n SQL_Server_Name -p UDP -e 1434
Copy Code
If we receive a response listing our instance, SQL Browser, and firewall settings are fine.
Sometimes, DNS resolution issues can also result in file access errors, such as the infamous Operating system error 5 (Access is denied), which may appear when attempting backup or restore operations.
Solution 4. Use the Correct Connection String in Code
In some development environments, this issue may be caused by the application’s connection method. For example, in Entity Framework:
public class DatabaseContext : DbContext
{
public DatabaseContext()
: base("DefaultConnection") // Correct named connection string
{
}
public DbSet SomeModels { get; set; }
}
Copy Code
Ensure the connection string name matches what’s defined in the configuration file (e.g., `web.config` or `appsettings.json`).
Additionally, if your application needs to manage database access dynamically, especially when handling multiple active sessions, you might find it helpful to kill all connections to a SQL Server database before performing certain operations.
Final Connectivity Checklist
Let’s wrap up with a quick checklist:
- Correct server and instance names.
- SQL Server and SQL Browser services are running.
- Firewall rules allow TCP 1433 and UDP 1434.
- DNS resolves the server name correctly.
- Network connectivity is stable. (ping test works).
- The connection string in the code/app is correct.
If all else fails, test the connection using SQL Server Management Studio (SSMS) and check if the issue is from the application or network configuration.
For more advanced SQL Server issues, such as cryptographic key errors, you may encounter messages like Service Master Key Decryption Failed. If so, check out this step-by-step fix.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
SQL Server Error 26 indicates a misconfiguration or network restriction. By systematically checking the server settings, network setup, and connection strings, you can quickly identify the root cause and restore connectivity.
In short, our Support Engineers demonstrated how to fix SQL Server Error 26: Error Locating Server/Instance Specified.
0 Comments