문제

I get the following error upon running a query.

*

System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

*

Is this a connection timeout or command timeout?

TIA

도움이 되었습니까?

해결책

Looks like a command timeout. If you have a connection timeout, you will see from the stack trace that it's thrown from a call to SqlConnection.Open. Any other timeout will be a command timeout.

다른 팁

You will need to post more code as to how you connection and what you are trying to execute. A command timeout propogates to a sqlexception timeout error so it could be.

What is the commmand or query you are trying to run? Once posted we may help optimize it. You can also try to set a timeout period for both the connection and the command object. Increase it and see if it helps.

How long does the query take when run from SSMS?

If fast, then you problem could be a deadlock.

Are you using any transactions? Are you sharing the database with other applications/users?

More info will be very useful.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top