2011-08-30 17 views
2

我有一個使用實體框架的標準ASP.NET 4網站。似乎在隨機間隔,我得到致命的錯誤。刷新頁面的作品,但我知道這不是數據庫的問題。異常似乎是由實體框架造成的,但我不確定如何追蹤它。有沒有其他人遇到過這個問題,或者有什麼方法可以進一步追蹤發生了什麼?'/'中的服務器錯誤應用程序

的錯誤是:

Server Error in '/' Application. 
A severe error occurred on the current command. The results, if any, should be discarded. 
A severe error occurred on the current command. The results, if any, should be discarded. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded. 
A severe error occurred on the current command. The results, if any, should be discarded. 

Source Error: 

Line 758:    mainImage = Db.ContentImages.FirstOrDefault(i => i.ItemID == itemId && i.t_ItemType == (int) itemType && i.MainImage); 
Line 759:    if(mainImage == null) { 
Line 760:     var firstVideo = Db.ContentVideos.FirstOrDefault(i => i.ItemID == itemId && i.t_ItemType == (int) itemType && !string.IsNullOrEmpty(i.PreviewImage)); 
Line 761:     if(firstVideo == null) { 
Line 762:  

這不只是發生在上述地點,而是隨機在所有的EF我的代碼。我甚至嘗試重新創建EDMX無濟於事。

+0

你正在使用什麼數據庫版本? – Jason

+0

該網站實際上使用博客引擎自己的SQL DB成員資格提供程序和角色提供程序構建在BlogEngine.NET之上。儘管如此,我在過去也使用了相同的配置(.NET 4上的BE.NET,Sql Server和Entity Framework)。 – Echilon

回答

0

這個問題有一個解決方法 - 檢查它是否符合您的方案。

http://support.microsoft.com/kb/910416

+0

謝謝,但這是SQL Server 2008 R2 – Echilon

+0

你[看過這個](http://support.microsoft.com/kb/2421014)呢?我可能值得運行分析器,並看到它有任何CTE正在使用。修補程序位於[累積更新程序包4](http://support.microsoft.com/kb/2345451)。 – TheCodeKing

相關問題