Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework System.Data.Objects.ObjectQuery导致System.AccessViolationException异常_Entity Framework_Access Violation - Fatal编程技术网

Entity framework System.Data.Objects.ObjectQuery导致System.AccessViolationException异常

Entity framework System.Data.Objects.ObjectQuery导致System.AccessViolationException异常,entity-framework,access-violation,Entity Framework,Access Violation,我的w3wp.exe中不时会出现System.AccessViolationException类型的异常,导致应用程序崩溃 异常堆栈如下(从事件查看器获取): 有人知道为什么会这样吗?我每1小时调用一次这个函数,有时会给出这个异常,上次花了2天半的时间才发生,另一件有趣的事情是我正在做一个try/catch,难道我不能捕获异常并防止w3wp.exe崩溃吗 提前感谢,, Rui看起来像是ASP.NET的CLR或IIS主机中的错误(或安装中断-不匹配的组件等)。您是否尝试过迁移到.NET Frame

我的w3wp.exe中不时会出现System.AccessViolationException类型的异常,导致应用程序崩溃

异常堆栈如下(从事件查看器获取):

有人知道为什么会这样吗?我每1小时调用一次这个函数,有时会给出这个异常,上次花了2天半的时间才发生,另一件有趣的事情是我正在做一个try/catch,难道我不能捕获异常并防止w3wp.exe崩溃吗

提前感谢,,
Rui看起来像是ASP.NET的CLR或IIS主机中的错误(或安装中断-不匹配的组件等)。您是否尝试过迁移到.NET Framework 4.5?该错误可能已在较新版本中修复。考虑把这个bug报告回微软-恐怕这可能不是一个简单的解决办法。< /P>谢谢你的安赛Pawel。我将尝试就此联系Microsoft。Pawel我应该通过connect.Microsoft.com联系MS吗?如果是,我应该选择哪种产品?与Sql Server相关?谢谢
Log Name:      Application
Source:        .NET Runtime
Date:          05-04-2013 00:00:27
Event ID:      1026
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      MYSERVER
Description:
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor()
   at System.Data.Common.Internal.Materialization.CoordinatorScratchpad..ctor(System.Type)
   at System.Data.Common.Internal.Materialization.Translator.ProcessCollectionColumnMap(System.Data.Query.InternalTrees.CollectionColumnMap, System.Data.Common.Internal.Materialization.TranslatorArg, System.Data.Query.InternalTrees.ColumnMap, System.Object)
   at System.Data.Common.Internal.Materialization.Translator.Visit(System.Data.Query.InternalTrees.SimpleCollectionColumnMap, System.Data.Common.Internal.Materialization.TranslatorArg)
   at System.Data.Query.InternalTrees.SimpleCollectionColumnMap.Accept[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Data.Common.Internal.Materialization.TranslatorArg, System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Data.Query.InternalTrees.ColumnMapVisitorWithResults`2<System.__Canon,System.Data.Common.Internal.Materialization.TranslatorArg>, System.Data.Common.Internal.Materialization.TranslatorArg)
   at System.Data.Common.Internal.Materialization.Translator.TranslateColumnMap[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Data.Common.QueryCache.QueryCacheManager, System.Data.Query.InternalTrees.ColumnMap, System.Data.Metadata.Edm.MetadataWorkspace, System.Data.Objects.Internal.SpanIndex, System.Data.Objects.MergeOption, Boolean)
   at System.Data.Common.Internal.Materialization.ShaperFactory+TypedShaperFactoryCreator`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TypedCreate(System.Data.Common.QueryCache.QueryCacheManager, System.Data.Query.InternalTrees.ColumnMap, System.Data.Metadata.Edm.MetadataWorkspace, System.Data.Objects.Internal.SpanIndex, System.Data.Objects.MergeOption, Boolean)
   at System.Data.Common.Internal.Materialization.ShaperFactory.Create(System.Type, System.Data.Common.QueryCache.QueryCacheManager, System.Data.Query.InternalTrees.ColumnMap, System.Data.Metadata.Edm.MetadataWorkspace, System.Data.Objects.Internal.SpanIndex, System.Data.Objects.MergeOption, Boolean)
   at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Prepare(System.Data.Objects.ObjectContext, System.Data.Common.CommandTrees.DbQueryCommandTree, System.Type, System.Data.Objects.MergeOption, System.Data.Objects.Span, System.Collections.ObjectModel.ReadOnlyCollection`1<System.Collections.Generic.KeyValuePair`2<System.Data.Objects.ObjectParameter,System.Data.Objects.ELinq.QueryParameterExpression>>)
   at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(System.Nullable`1<System.Data.Objects.MergeOption>)
   at System.Data.Objects.ObjectQuery`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResults(System.Nullable`1<System.Data.Objects.MergeOption>)
   at System.Data.Objects.ObjectQuery`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Linq.Enumerable.Single[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<Boolean>)
   at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<Boolean>)
   at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<Boolean>, System.Linq.Expressions.Expression)
   at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.Expressions.Expression)
   at System.Linq.Queryable.Any[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Linq.IQueryable`1<System.__Canon>)
   at MY.WebService.NetworkValidation.ValidIp(System.String)
   at MY.WebService.SedeService.IsLogged(MY.DataBase.SedeData.User)
   at MY.WebService.Sede.IsLogged()
   at DynamicClass.SyncInvokeIsLogged(System.Object, System.Object[], System.Object[])
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(System.Object, System.Object[], System.Object[] ByRef)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(System.ServiceModel.Dispatcher.MessageRpc ByRef)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean)
   at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(System.ServiceModel.Channels.RequestContext, Boolean, System.ServiceModel.OperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(System.ServiceModel.Channels.RequestContext, System.ServiceModel.OperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(System.IAsyncResult)
   at System.ServiceModel.Dispatcher.ChannelHandler.OnContinueAsyncReceive(System.Object)
   at System.Runtime.IOThreadScheduler+ScheduledOverlapped.IOCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
try
{                
    using(var db = new AccessEntities())
    {
        var ret = db.AccessControl.Where(xx => xx.Ip == ip && xx.IsValid).Any();                    
        return ret;
    }
}
catch (Exception ee)
{                
    return false;
}