> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/rdm/knowledge-base/troubleshooting-articles/sql-server-connection-timeout.md).

# SQL Server connection timeout

Connection timeouts with an SQL Server can take many forms. Here are some of the most common:

`System.Data.SqlClient.SqlException : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.`

`System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out.`

`Microsoft.Data.SqlClient.SqlException (0x80131904): 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: TCP Provider, error: 0 - This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.)`

`Microsoft.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=5018; handshake=12;`

See the full list of errors in [Timeout expired messages when connecting to SQL Server](https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/timeout-expired-error#verify-timeout-expired-errors).

### Solution 1

To address this issue, the initial approach you should consider is [increasing your connection timeout](https://docs.devolutions.net/rdm/workspaces/workspace-types/native-workspaces/microsoft-sql-server/#advanced).

1. In Remote Desktop Manager, go to ***File – Workspaces*** and edit your Microsoft SQL Server workspace by clicking on the ***Edit workspace*** icon.
2. In the ***Advanced*** tab, increase the ***Connection timeout*** delay.
3. Save your changes.

### Solution 2

If adjusting the connection timeout duration did not resolve the issue, check your firewall settings. SQL Server operates on dynamic ports, requiring the appropriate ports to be open for seamless communication between Remote Desktop Manager and your SQL Server. For guidance on which ports to enable, please consult the "Ports used by the Database Engine" section in [Configure the Windows Firewall to allow SQL Server access](https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver16#ports-used-by-the-database-engine).

### Solution 3

If you continue to experience connection timeout issues, the root cause might be related to the SQL Listener or availability groups. In such cases,try setting the ***MultiSubnetFailover*** value to ***True***.

1. In Remote Desktop Manager, go to ***File – Workspaces*** and edit your Microsoft SQL Server workspace by clicking on the ***Edit workspace*** icon.
2. In the ***Advanced*** tab, click on ***More settings***.
3. Search for the MultiSubnetFailover setting and set its value to ***True***.

   <div data-gb-custom-block data-tag="hint" data-style="success" class="hint hint-success"><p>It is recommended to use either <em><strong>Failover Partner</strong></em> and <em><strong>MultiSubnetFailover</strong></em>, not both simultaneously. Ensure the <em><strong>Failover Partner</strong></em> value is cleared.</p></div>
4. Click ***OK*** then save your changes.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>See this Microsoft article for more information: <a href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/availability-groups/listener-connection-times-out">Timeout occurs when you connect to an Always On listener in multi-subnet environment</a>.</p></div>

### Solution 4

[Certificate validation issues](https://docs.devolutions.net/rdm/kb/troubleshooting-articles/unable-to-connect-to-the-workspace/).

### Other possible solutions

If the solutions mentioned above have not resolved the issue, additional potential fixes can be found in the following Microsoft articles:

* [Timeout expired messages when connecting to SQL Server](https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/timeout-expired-error)
* [A network-related or instance-specific error occurred while establishing a connection to SQL Server](https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection)

Feel free to [contact our customer support team](mailto:service@devolutions.net) for further assistance.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devolutions.net/rdm/knowledge-base/troubleshooting-articles/sql-server-connection-timeout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
