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.