开发者

DB timeout when generating report from the web

开发者_C百科

I've got a report in ASP.NET app. When I trying to generate it from the browser it crashes with DB timeout error, but when i'm executing exact same query in SQL Management Studio it shows the result set within 5 seconds.

Query is written unclean SQL in the code-behind file (no ORMs are used), it's parameters are from the web form, so i know what exact generated query will be.

What can be the cause of the problem?


First, use SQL Profiler to attach to the database and see exactly what query is being sent. Use that for other testing.

Second, set your connection timeout to something ridiculous like 300 seconds. Then do the same thing for the command timeout.

Third, make sure both your application and your management studio instance are talking to the same database... Preferably with the exact same user rights.

Run again. Then run it again.

It's possible that the database is taking time to do an initial load (hence the first query taking awhile) and the query through management studio is executing while the database is still "hot" so to speak.

Finally, you say that management studio shows results within 5 seconds.. Is it 5 seconds for it to start populating the query results window or 5 seconds for the entire query to finish executing. Those can be radically different times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜