1

I am getting the error

[Microsoft][Sql Server Native Client 11.0]
Query timeout expired

on SQL Server via ASP page. Most of the time it is working fine but sometimes I am getting this error. Can anyone tell me If this a SQL Server issue or ASP.NET issue?

I have run the same query in SSMS, it completed within seconds. ASP page can query anything. I am using sa user for auth, so I think it has full permissions.

1

This can be issue with both depending on how you look at it. You are getting a 'Query timeout' and not a 'Connection timeout'.
You have 2 options.

  • Increase your query timeout setting. Most of the time by default it is 30 seconds. See this links for ODBC and SqlCommand.

  • Set up an Extended Event trace (If you are not comfortable, do a server side trace with proper filters) and find the query that is timing out. Work on improving the run time till it is below 'Query Timeout' setting. There were times I was able to capture the query with out trace and just by using sp_whoisactive. I was watching total run time.

1

You haven't mentioned which version of SQL Server you're using. If you're 2008 R2 or above, I'd have a look in system_health Extended Event.

System Health Extended Event will show queries that have been waiting for up to 30 secs. As such, depending on your timeout you've already set, you may be able to pick it up without setting up another Extended Event/Server-Side trace.

FYI - if you're on 2008R2, this is a good article as the GUI doesn't exist.

https://www.mssqltips.com/sqlservertip/3636/query-data-from-extended-events-in-sql-server/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.