I've just randomly started getting this issue, and previously it has been fine up until tonight. I do not want to touch the timeout stuff, I believe it's not needed.
It's a simple query.
{"Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding."}
Here is the code causing the timeout..
var post = (开发者_JAVA技巧from p in con.blog_posts
orderby p.post_dt descending
select p).First();
Can anyone think of any crevices I should check to try an resolve this?
edit: I can connect to the server with management studio and it is up..
you could avoid the sort:
var post =
from p in con.blog_posts
where p.post_dt == con.blog_posts.Max(post=>post.post_dt)
select p
Are other database queries working as expected? Go to your database and run that query and see how long it takes to return. Try to run the exact query (capture it in SQL Profiler). This will tell you if your database is simply performing slowly for this query, or whether it's another issue.
My first guess would be that you don't have an index on the post_dt
column. Trying the query directly in SQL will prove or disprove this. If the query takes a long time to run, add a nonclustered index on that column and retry.
精彩评论