Sql Server : Connection Timeout v/s Command Timeout

Sql server provides two types of timeouts, thought they look same there is a huge difference between then

  • Connection Timeout

Connection timeout is the number of seconds to wait n try to get a connection to sql server. Default is 15 seconds. You can modify it using connection string. Use property **Connection Timeout = 30;**

Read more about it here

 

  • Command Timeout

Command timeout is the number of second to wait for completion of query execution. The default is 30 seconds. You can set it using **.Timeout()** method in dbContext.

Read more about it here