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?