Reputation: 176
I got the error
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
during the command execution.
I also set Connect Timeout=60
in the connection string.
That stored procedure execution time is around 35 seconds.
Connection is established, but result is not returned.
Upvotes: 1
Views: 18311
Reputation: 904
You can also extend connection timeout in connectionstring
;Connection Timeout=30
See: Connection timeout for SQL server
Upvotes: 0
Reputation: 1062512
DbCommand
has CommandTimeout
, which is what you want here - it is set per command; the "connect timeout" only impacts, reasonably enough, what the timeout is for connecting. The default value for CommandTimeout
on SqlCommand
is 30 seconds.
Upvotes: 9