'/' 中的服务器错误应用
我有一个使用实体框架的标准 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题有一个修补程序 - 检查它是否符合您的场景。
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