1

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.

3

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You can also extend connection timeout in connectionstring

;Connection Timeout=30

See: Connection timeout for SQL server

1 Comment

that is the timeout for connecting, not for executing. You cannot set the execution timeout in the connectionstring

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.