我有一个使用 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 但无济于事。
最佳答案
该问题有一个热修复程序 - 检查它是否符合您的场景。
关于c# - '/' 应用程序中的服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7247760/