我的应用程序是asp.net MVC3中,我使用的SQLExpress 2012年我收到以下错误超时连接到SQL Server Express 2012
超时过期。操作完成之前超时的时间或服务器没有响应。
当我尝试运行以下命令:
public static List<vw_MasterView> GetMasterView(DateTime? fromDate, DateTime? toDate)
{
if (fromDate == null) fromDate = new DateTime(1900, 1, 1);
if (toDate == null) toDate = DateTime.Now;
using (DALDataContext ctx = new DALDataContext())
{
var q = from c in ctx.vw_MasterViews
where c.FirstVisitDate >= fromDate && c.LastVisitDate <= toDate
select c;
return q.ToList();
}
}
我确实增加了连接时间(服务器/提前属性)至6000
当我运行从设计师的观点(在SQL Server)我得到相同的错误消息,但是当我运行查询(在SQL服务器)它工作正常,它需要54秒执行。
我希望你的建议,在此先感谢。
您可以检查是否存在打开交易? sp_who(http://msdn.microsoft.com/en-us/library/ms174313.aspx)可能能够列出持有连接的所有进程。 –
有几个sa(背景和睡眠),只有一个用户可以运行。 – hncl
在这种情况下,我想知道DALDataContext的作用是什么?是否有可能分享实施? –