時々、アプリをクラッシュさせる w3wp.exe で System.AccessViolationException タイプの例外が発生します。
例外のスタックは次のとおりです (イベント ビューアーから取得)。
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*)
関数 ValidIp(string ip) のコード (例外を取得する前に呼び出す最後の関数):
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;
}
なぜこれが起こっているのか誰にも分かりますか?私はこの関数を 1 時間ごとに呼び出し、時々この例外を発生させます。前回は 2 日半かかりました。もう 1 つの興味深いことは、try/catch を実行していて、例外をキャッチして回避できないことです。 w3wp.exe クラッシュ ?
前もってありがとう、ルイ