About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
The message is "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." It appears in application logs, in SSMS and in service desk tickets, and it is used for two quite different faults. Treating a slow query as a network fault, or the reverse, sends the investigation the wrong way.
Microsoft's page says a "Timeout expired" error in SQL Server "means that a connection or command operation didn't complete within the time-out interval that the client application allows, so the client canceled the operation instead of waiting indefinitely."
What the error means
Microsoft says there are two types of timeout problem seen with database applications:
- Connection timeout, 15 seconds by default.
- Query or command timeout, 30 seconds by default.
Microsoft's page explains that they "come from different sources and happen in separate independent phases" of an application's interaction with the database. A connection timeout occurs when the initial connection to the database engine fails. A query or command timeout happens later: "The initial connection has gone through successfully but a query you submitted to the database server is taking a long time to complete."
The page lists several wordings that go with a connection timeout, including:
System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired.- "The timeout period elapsed while attempting to consume the pre-login handshake acknowledgment."
System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out.System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool.
The last of those is a pool problem, not a network problem. Microsoft says it happens when "all pooled connections are in use, and max pool size is reached", and it sends you to its article on an exhausted connection pool.
Likely causes
For a connection timeout, Microsoft lists causes in two groups.
| Group | Typical cause on Microsoft's page |
|---|---|
| Service, port and protocol | The SQL Server service on the server isn't running |
| The TCP/IP port for the Database Engine instance is blocked by a firewall | |
| The Database Engine isn't listening on port 1433, because the port was changed or it is a named instance and the SQL Server Browser service isn't running | |
| The SQL Server Browser service is running but UDP port 1434 is blocked by a firewall | |
| Client and server aren't configured to use the same network protocol | |
| Network and name resolution | Server name typed incorrectly |
| The network can't resolve the server name to an IP address | |
| The network can't connect by using the IP address |
A query or command timeout is a different matter and Microsoft handles it in its separate article, "Troubleshoot query time-out errors". Its cause is a query that is slow to complete.
Prove the cause before changing anything
All of these only read.
- Get the complete call stack of the error, not only the message line. Microsoft says: "Before troubleshooting, view the complete call stack of the error messages to determine the error type."
- Read the stack for the clue Microsoft names. A stack that ends in
SqlConnection.Open()is a connection timeout: "SqlConnection.Open indicates that the client is trying to open a connection and therefore isn't related to a query." A stack that goes throughSqlCommand.ExecuteScalar()(orExecuteReaderorExecuteNonQuery) is a query or command timeout, because "The SqlCommand class is used to work with a query, not a connection." - For a connection timeout, check from the client whether the server name resolves. Microsoft's page gives
telnet <ServerName> [<Port>]andtelnet <IP_Address> <Port>, and says: "If using an IP address works, but the server name doesn't work, it's a name resolution issue." It also namespingandtracertfor testing a connection by IP address. - On the server, check that the SQL Server service is running, and for a named instance that the SQL Server Browser service is running.
- Look in the SQL Server error log for the port the instance is listening on. Microsoft says to find the port number there.
- In SQL Server Configuration Manager, confirm the client and server share at least one enabled protocol.
Example (illustrative): at contoso.com.au a reporting app times out opening connections to SQL02\REPORTS every morning. The stack ends at SqlConnection.Open(). telnet SQL02 1433 fails, while the instance's real port (found in the error log) is 51433. The named instance listens on a non-default port and the SQL Server Browser service was stopped by a maintenance script, so the client cannot find the port.
Fix
Fix only the cause the proof showed. Microsoft does not offer one fix for every timeout.
A connection timeout: try a longer connection time-out first, as a test
Microsoft's first step is to raise the connection time-out and see whether the connection eventually works: "If the connection eventually succeeds, it's a network issue. Work with your network administrator to resolve the issue." It also says the change is a possible method, not a long-term resolution, because the connection occurs quickly, within a few milliseconds.
Save first. Write down the current connection time-out value in the application's connection string or settings (the default is 15 seconds), or in SSMS the value shown on the Connection Properties tab.
Risk: The next step changes how long one client waits before giving up on a connection. A longer wait makes a failing connection look slower, and an application that waits 30 seconds per attempt can pile up requests. The change applies only to the client setting you edit.
In an application that uses System.Data.SqlClient, set the SqlConnection.ConnectionTimeout property to 30 or a higher value. With the current Microsoft.Data.SqlClient driver, Microsoft says to set the equivalent SqlConnection.ConnectionTimeout property. In SSMS, select the Connection Properties tab in the Connect to Server dialog box and set the Connection time-out setting to a higher value.
To undo it: put the value you wrote down back in the same place. Microsoft says that once the network issue is resolved you can revert to the default settings in your application.
Start the SQL Server Browser service, or connect by port
For the named-instance row, Microsoft says to start the SQL Server Browser service, or to specify a TCP/IP port number to connect with Sqlcmd -S <ip_addres>,<port>. The page spells the placeholder <ip_addres>; it means the IP address.
Save first. Note the current state of the SQL Server Browser service (running or stopped) and its startup type in the Services app.
Disruptive step: The next step starts a service on the SQL Server host. Clients that rely on the SQL Server Browser service to find a named instance's port start finding it. It changes nothing for clients that connect by port number.
- In the Services app on the server, right-click SQL Server Browser and select Start.
To undo it: right-click the same service and select Stop. If its startup type was changed, return it to the type you noted.
The connection-by-port alternative changes only the client:
sqlcmd -S <ip_address>,<port>
Firewall, name resolution and protocol rows
For a blocked port, Microsoft's resolution is to "Configure the firewall to permit access to the Database Engine", or, for UDP port 1434, to permit that port or connect by the TCP/IP port number. For name resolution, Microsoft says to fix the name resolution problem on your network or connect by IP address, and calls that "isn't a SQL Server problem". The page gives no firewall commands or rule syntax, so none are given here; a change to a firewall rule is the network administrator's change, with the rule recorded first so it can be removed.
A query or command timeout
Microsoft treats this as a separate task and points to "Troubleshoot query time-out errors". The page describes this kind as an initial connection that succeeded followed by a query that takes a long time to complete, so the question to answer is what the command was waiting on.
Confirm the fix
- Repeat the action that timed out and check it completes within the default 15 seconds for connections.
- For a named instance, test with the instance name and with the port.
- Watch the next scheduled run of the application that failed.
What to watch afterwards
- Whether you left a raised time-out in place. Microsoft says increasing it is not a long-term resolution.
- Services that maintenance scripts stop and start, especially SQL Server Browser.
- Pool exhaustion, which uses the same words. A "prior to obtaining a connection from the pool" message is a pool problem.
Read next
Related articles you may want next.
- TroubleshootingSQL Connection Pool Timeout: Find Leaked or Long-Held ConnectionsDistinguish pool acquisition from login or command timeout and identify why connections are unavailable.Read article
- TroubleshootingSQL Requests Are Waiting: Find the Head Blocker Before Ending SessionsBuild a time-correlated blocking chain and identify the transaction owner before deciding on intervention.Read article
- TroubleshootingSQL Server 'A network-related or instance-specific error occurred' (error 26, 40, 53): find where the connection stops'Error Locating Server/Instance Specified' (error 26) or error 40: check the service, instance name, TCP, port, Browser UDP 1434 and firewall in order.Read article
Risks and limits
These steps have not been run in a lab. Microsoft's page gives default values of 15 and 30 seconds and the stack-trace clue; it gives no firewall rule syntax and no version range for the settings. A longer time-out does not repair a network fault; it only gives the connection longer to succeed.
Sources
- Troubleshoot connection timeout errors when connecting to SQL Server — Microsoft Learn, page dated 2026-08-12, accessed 1 December 2026
This article was originally published on .