c# - '/' 应用程序中的服务器错误

标签 c# asp.net entity-framework ado.net-entity-data-model edmx

我有一个使用 Entity Framework 的标准 ASP.NET 4 网站。似乎在随机的时间间隔内,我会遇到 fatal error 。刷新页面有效,但我知道这不是数据库的问题。异常似乎是由 Entity Framework 引起的,但我不确定如何追踪它。有没有其他人遇到过这种情况,或者有什么方法可以进一步追踪正在发生的事情吗?

错误是:

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 但无济于事。

最佳答案

该问题有一个热修复程序 - 检查它是否符合您的场景。

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

关于c# - '/' 应用程序中的服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7247760/

相关文章:

c# - Linq如何写一个JOIN

c# - session 状态变量不起作用

C#,从gridview元素中删除第一行

asp.net - 子文件夹中的 .NET 基本 href 和样式表链接

c# - IQueryable<T>.Include() 被忽略

c# - 对象可以将其自身设置为 null 吗?

c# - 如何在asp.net c#中验证文本框只输入几个选项​​?

c# - C# 一次性变量的自一次性(内联)声明

c# - 如何识别主物理网卡的MAC地址?

c# - 与连接(桥接)表的一对多关系