Ho avuto un guasto sul mio webhost. Ora finalmente è di nuovo in su, e devo ancora sapere cosa hanno riparato i tecnici. Il problema è ora ricevo l'errore:Entity framework Chiamare 'Leggi' quando il datareader è chiuso
Calling 'Read' when the data reader is closed is not a valid operation.
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.InvalidOperationException: Calling 'Read' when the data reader is closed is not a valid operation.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Calling 'Read' when the data reader is closed is not a valid operation.]
System.Data.Common.Internal.Materialization.Shaper`1.StoreRead() +93
System.Data.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +30
System.Linq.Enumerable.Single(IEnumerable`1 source) +119
System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2(IEnumerable`1 sequence) +5
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +25
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +43
System.Linq.Queryable.Count(IQueryable`1 source) +240
BusinessLayer.Car.GetCarCount() in xxx
UserControls_SiteInfo.Page_Load(Object sender, EventArgs e) +225
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Non ho cambiato nulla, quindi potrebbe essere alcune autorizzazioni? Posso ancora accedere al mio database con le stesse credenziali quindi non sono le informazioni di accesso. Qualcuno ha un'idea?
AGGIORNAMENTO: Ho scoperto che ottengo l'errore quando provo a convertire IQuery in un elenco. Non ho mai ricevuto l'errore prima, questo suggerisce a qualcuno di voi cosa potrebbe essere sbagliato?
cosa succede quando si esegue una query SQL diretta? (non usando linq-to-sql) –
Ho scoperto che si tratta di un errore con il mio database o con la rete sul mio webhost, quindi non ha nulla a che fare con l'entità stessa. – Dofs
La modifica di 'IEnumerable' in' IList' ha risolto il problema per me Sto restituendo un oggetto complesso da un sproc – safhac