0

In our ASP.Net application, we have some queries (not just one) that are, at times, causing Time-Out errors in the application. But, when I run the same query on SQL server management studio on the server, it runs fine within 1 second.

I tried alternating the query via the app and via SSMS and also ran them simultaneously. However, the app times out and the SSMS query runs fine.

I also check that there were no blocking queries during the time the query from the app was running. Same behavior is seen on both production and development environment. In the app, the time-out happens on the SQLCommand.ExecuteScalar method.

Any idea what could be the issue?

navigator
  • 1,678
  • 16
  • 29
  • Is the ASP.net application on the same server that the SQL server? If not maybe it is some network issues and problem is in the communication between ASP.net server and SQL server? – Cezary Jan 16 '15 at 13:17
  • It is on the same server. And issue is happening in development environment as well. – navigator Jan 16 '15 at 13:19
  • It is possible that maybe some SQL transaction is holding some table or view and this couses that even some simple queries are taking long if they are using thouse blocked tables. Can you check if it happens or maybe some HOLDLOCK is used in queries? – Cezary Jan 16 '15 at 13:28
  • It happens on the development environment too and there are no other queries running at the time. There are no transactions or locks. I also found that the issue is related to the parameters passed into the command as well. It works fine for some value and not for others. However, in SSMS, it always works fine. – navigator Jan 16 '15 at 13:31
  • Probably a dozen duplicates are more ... http://stackoverflow.com/search?tab=votes&q=fast%20in%20ssms%20slow%20in%20application ... also see here ... http://www.sommarskog.se/query-plan-mysteries.html – Aaron Bertrand Jan 16 '15 at 13:40

0 Answers0