'/' 中的服务器错误应用

发布于 2024-12-02 10:03:04 字数 1378 浏览 0 评论 0原文

我有一个使用实体框架的标准 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,但无济于事。

I have a standard ASP.NET 4 web site which uses the Entity Framework. It seems at random intervals, I get fatal errors. Refreshing the page works, but I know it's not a problem with the database. The exception seems to be caused by the entity framework but I'm not sure how to trace it beyond that. Has anyone else encountered this or is there any way to further trace what's happening?

The error is:

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:    

This doesn't just happen at the above location, but rather randomly throughout all of my EF code. I've even tried recreating the EDMX to no avail.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骄兵必败 2024-12-09 10:03:04

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

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

There's a hot fix for the issue - check if it matches your scenario.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文