执行超时已到期。操作完成之前经过的超时时间或服务器没有响应。 [英] Execution timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

查看:151
本文介绍了执行超时已到期。操作完成之前经过的超时时间或服务器没有响应。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Error Message :An error occurred while executing the command definition. See the inner exception for details.Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.





查询:



Query:

var checkit1 = (from pm in db.productmasters.AsNoTracking()
                                       join pimg in db.ProductImages.AsNoTracking()
                                       on pm.PID equals pimg.PID
                                       join sb in db.SubCategoryMasters.AsNoTracking()
                                        on pm.SUBID equals sb.SUBID
                                       where (
                                        pm.CID == i &&
                                             pm.Isdeleted == "NO" &&
                                             pimg.IsDeleted == "NO" &&
                                             pimg.FIMG == "YES" &&
                                             (
                                             pm.Descr.Contains(spara) || pm.Descr.StartsWith(spara) || pm.Descr.EndsWith(spara) || pm.Brand.Contains(spara) || pm.Brand.StartsWith(spara) || pm.Brand.EndsWith(spara) || pm.Class.Contains(spara) || sb.SubCategoryName.StartsWith(spara) || sb.SubCategoryName.EndsWith(spara) || sb.SubCategoryName.Contains(spara) || pm.productname.Contains(spara) || pm.productname.StartsWith(spara) || pm.productname.EndsWith(spara) ))
                                       orderby pm.PID descending
                                       select new CDBookModel
                                       {
                                           FIMG = pimg.FIMG,
                                           BRAND = pm.Brand,
                                           CID = (int)pm.CID,
                                           CLASS = pm.Class,
                                           DESCR = pm.Descr,
                                           ID = (int)pimg.ID,
                                           NAME = pimg.Name,
                                           PID = (int)pm.PID,
                                           PRICE = pm.Price,
                                           PRODUCTNAME = pm.productname
                                       })
                               .Distinct().ToList();
                       ViewBag.GetSearchData = checkit1;





我的尝试:





What I have tried:

Error Message :An error occurred while executing the command definition. See the inner exception for details

推荐答案

您给出的命令在服务器上执行的时间太长,并且与数据库的连接是关闭。



您需要尝试直接在SSMS中运行查询,看看是否可以在那里进行优化,或者在连接字符串中增加连接超时。请注意,默认值为30秒IIRC,因此如果超出此范围,您的应用或数据设计可能会出现问题。



猜测,它是所有的StartsWith等等 - 如果你有很多行,那可能是一个严重的瓶颈。
The command you gave took too long to execute on the server, and the connection to your DB was closed.

You need to try running the query directly in SSMS and seeing if you can optimise it there, or increase the connection timeout as part of your connection string. Be aware, that the default is 30 seconds IIRC, so if you are exceeding that, you may have a problem with your app or data design.

At a guess, it's all the StartsWith and suchlike - if you have a lot of rows, that could be a serious bottleneck.


这篇关于执行超时已到期。操作完成之前经过的超时时间或服务器没有响应。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆