2011-08-30 20 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

相关问题