Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Error Message:

Causes:

  1. Enter correct system name and instance name.
  2. Firewall on the server may refused the connection.
  3. VIA protocol might be enabled and it may be using port 1433.
  4. SQL Browser service might be disabled.
  5. This issue occurs because of an error in the connection-retry algorithm for mirrored databases.When the retry-algorithm is used, the data provider waits for the first read (SniReadSync) call to finish. The call is sent to the back-end computer that is running SQL Server, and the waiting time is calculated by multiplying the connection time-out value by 0.08. However, the data provider incorrectly sets a connection to a doomed state if a response is slow and if the first SniReadSync call is not completed before the waiting time expires.

Workaround 1: Switch off the firewall

  1. Click Start > Run
  2. type firewall.cpl
  3. Make it Off

Workaround 2:

  1. Open SQL Server Configuration Manager
  2. SQL Server Network configuration
  3. Protocols for RELYONDB
  4. The status of “VIA” protocol should be disabled
  5. Right click “VIA” > Properties > Default Port should be empty.

Workaround 3: Restart both SQL Server RELYONDB & SQL Server Browser services.

  1. Click Start > Run
  2. type services.msc
  3. Select SQL Server RELYONDB service
  4. Click Restart
  5. Select SQL Server Browser service
  6. Click Restart.

Workaround 4:

To work around this problem, perform one of the following actions:

Create an exception in the Windows Firewall with Advanced Security on the client computer.

Workaround 5:

 

The error occurs when the execution time beyond Timeout Property. When you are trying to connect or access to a Database table which is having large volume of data, query execution time will be more. There are two main Timeout property in ADO.NET.

 

 

1. Connection Timeout for Connection. It could be solved by setting ConnectionTimeout property of Connection object in Connection String.

 

2. Timeout for Data access ( Command Object ). You can set CommandTimeout property to Command object. I recommend you set CommandTimeOut property to bigger one value.

Example: During development process write the below code to avoid Timeout expired exception.

SqlCommand1.CommandTimeout = 500000