2

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.

Echilon
  • 10,064
  • 33
  • 131
  • 217
  • what database version are you using? – Jason Aug 30 '11 at 18:10
  • The site is actually built on top of BlogEngine.NET using blog engine's own SQL DB Membership provider and Role provider. I've used this same configuration (BE.NET, Sql Server and Entity Framework on .NET 4) in the past without problems though. – Echilon Aug 30 '11 at 18:17

1 Answers1

0

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

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

vtortola
  • 34,709
  • 29
  • 161
  • 263
TheCodeKing
  • 19,064
  • 3
  • 47
  • 70
  • Thanks, but this is SQL Server 2008 R2 – Echilon Sep 03 '11 at 11:31
  • Have you [seen this](http://support.microsoft.com/kb/2421014) then? I might be worth running profiler and see it's there's any CTE being used. A fix is in [Cumulative Update package 4](http://support.microsoft.com/kb/2345451). – TheCodeKing Sep 03 '11 at 11:35