简体   繁体   中英

How to fix the wait operation is timed out?

Whenever the database query is fired it gives the error 'The wait operation is timed out'. So how can I get rid of this error?

I am using LINQ to get the data.

The error is pretty clear that tells you query execution has been dropped to timeout. So, you can refactor the query or increase the command timeout of _context ;

public class SampleDbContext: DbContext
{
    public SampleDbContext(string nameOrConnectionString) : base(nameOrConnectionString)
    {
        ((IObjectContextAdapter)this).ObjectContext.CommandTimeout = 180;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM