每隔一段时间Entity Framework Timesout总是在同一个SQL View上然后我总是有两个选项来修复网站
我运行此查询
USE [ibeems]
DBCC FREEPROCCACHE
OR
我改变了视图
然后网页会在接下来的几天内立即打开。
这是视图
USE [ibeems]
GO
ALTER VIEW [dbo].[ViewNewVerificationList]
AS
SELECT
dbo.Quotation.ClientId, dbo.Quotation.ActualTurnover,
dbo.Quotation.VerificationFee, dbo.Quotation.ConsultationFee,
dbo.Quotation.RequestDateTime, dbo.Quotation.ConsultantFirmId,
dbo.Quotation.CompanyId,
dbo.ActionHistory.ActionNameId AS LastActionID,
dbo.ActionHistory.ActionDateTime AS LastActionDateTime,
dbo.ActionHistory.Message AS LastActionNote,
dbo.ActionHistory.ActionHistoryId AS LastQuotationActionHistoryId,
dbo.ActionHistory.ActionCategoryId AS LastActionCategoryID,
dbo.Client.CompanyName, dbo.Client.RegistrationNumber,
dbo.Client.ContactPerson, dbo.Client.ContactCellNumber,
dbo.Client.ContactEmail, dbo.Client.ConsultantId,
dbo.Consultant.Name, dbo.Consultant.Surname,
dbo.Quotation.Active AS QuotationActive,
dbo.Client.ClientCategoryId, dbo.Quotation.VerificationType,
dbo.Client.NoClientLogin,
dbo.VerificationTask.VerificationTaskId,
dbo.VerificationTask.StartedDateTime,
dbo.VerificationTask.FilePrepConsultantId,
dbo.VerificationTask.SubCharterSectorID,
dbo.VerificationTask.Active,
dbo.VerificationTask.CertificateDirectory,
dbo.VerificationTask.FinishDateTime, dbo.VerificationTask.UserId,
dbo.VerificationTask.QuoteId,
dbo.[User].Name AS UserName, dbo.[User].Surname AS UserSurname,
dbo.[User].IdNumber, dbo.[User].CellNumber,
dbo.[User].EmailAddress
FROM
dbo.Quotation
INNER JOIN
dbo.Client ON dbo.Quotation.ClientId = dbo.Client.ClientId
INNER JOIN
dbo.VerificationTask ON dbo.Quotation.QuoteId = dbo.VerificationTask.QuoteId
INNER JOIN
dbo.Consultant ON dbo.VerificationTask.FilePrepConsultantId = dbo.Consultant.ConsultantId
INNER JOIN
dbo.[User] ON dbo.VerificationTask.UserId = dbo.[User].UserId
INNER JOIN
dbo.ActionHistory ON dbo.Quotation.QuoteId = dbo.ActionHistory.QuoteId
INNER JOIN
(SELECT
ActionHistory.QuoteId,
MAX(ActionHistory.ActionHistoryId) As MaxId
FROM
ActionHistory
WHERE
(ActionNameId <> 9) AND (ActionNameId <> 23)
AND IsRemoved = 0
GROUP BY
ActionHistory.QuoteId) MaxActionHistory ON MaxActionHistory.MaxId = ActionHistory.ActionHistoryId
答案 0 :(得分:0)
看看这篇文章。
一些提示
您也可以remove a single plan from SQL Server,或者可能创建存储过程并使用EF进行映射。