IIS中的AccessViolationException(w3wp.exe)

时间:2017-03-24 03:11:19

标签: .net access-violation

我们在IIS 8.5上运行ASP.Net MVC应用程序(Windows Server 2012 R2) 有时(大约每天一次)它会在AccessViolationException和没有StackTrace的情况下崩溃。

EventLog简短信息:

<Event
xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
    <Provider Name="Windows Error Reporting" />
    <EventID Qualifiers="0">1001</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2017-03-23T07:34:19.000000000Z" />
    <EventRecordID>5204</EventRecordID>
    <Channel>Application</Channel>
    <Computer>WebKassaApp01</Computer>
    <Security />
</System>
<EventData>
    <Data />
    <Data>0</Data>
    <Data>CLR20r3</Data>
    <Data>Нет данных</Data>
    <Data>0</Data>
    <Data>w3wp.exe</Data>
    <Data>8.5.9600.16384</Data>
    <Data>5215df96</Data>
    <Data>System.Core</Data>
    <Data>4.0.30319.33440</Data>
    <Data>5200436c</Data>
    <Data>3a4</Data>
    <Data>54</Data>
    <Data>System.AccessViolationException</Data>
    <Data />
    <Data />
    <Data>C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_w3wp.exe_9ef793f5de646625877423c14a0d0c91ad3196_9e3fd63b_cb043ca8</Data>
    <Data />
    <Data>0</Data>
    <Data>1ec4b5d9-0f9b-11e7-80c7-000c29473f66</Data>
    <Data>4100</Data>
    <Data />
</EventData>

昨天我安装了Microsoft调试工具(DebugDiag)并运行内存转储文件分析(memory.hdmp)。它向我展示抛出AccessViolationException的堆栈跟踪:

System.Linq.Enumerable+WhereSelectEnumerableIterator`2[[System.__Canon, mscorlib],[System.Decimal, mscorlib]].MoveNext() 
System.Linq.Enumerable.Sum(System.Collections.Generic.IEnumerable`1) 
System.Linq.Queryable.Sum[[System.__Canon, mscorlib]](System.Linq.IQueryable`1, System.Linq.Expressions.Expression`1>) 
WebCash.Web.WebCashService.ToModel(System.Linq.IQueryable`1) 
WebCash.Web.WebCashService.GetLastReport(Int64, Int64, WebCash.Constants.Enums.ReportTypeEnum, Boolean) 
WebCash.Web.WebCashService.CreateXReport(WebCash.ServiceContracts.Request.XReportRequest) 
WebCash.Common.ParallelHelper.RunInMutex[[System.__Canon, mscorlib]](System.String, System.Func`1) 
WebCash.Web.Controllers.Api.BaseApiController.ExecuteAuthorizedOperation[[System.__Canon, mscorlib]](System.__Canon, System.Func`2) 
DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Object, System.Object[]) 
System.Web.Http.Controllers.ReflectedHttpActionDescriptor+ActionExecutor+<>c__DisplayClass10.b__9(System.Object, System.Object[]) 
System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext, System.Collections.Generic.IDictionary`2, System.Threading.CancellationToken) 
System.Web.Http.Controllers.ApiControllerActionInvoker+d__0.MoveNext() 
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Web.Http.Controllers.ApiControllerActionInvoker+d__0, System.Web.Http]](d__0 ByRef) 
System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsyncCore(System.Web.Http.Controllers.HttpActionContext, System.Threading.CancellationToken) 
System.Web.Http.Controllers.ActionFilterResult+d__2.MoveNext() 
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Web.Http.Controllers.ActionFilterResult+d__2, System.Web.Http]](d__2 ByRef) 
System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(System.Threading.CancellationToken) 
System.Web.Http.Dispatcher.HttpControllerDispatcher+d__1.MoveNext() 
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Web.Http.Dispatcher.HttpControllerDispatcher+d__1, System.Web.Http]](d__1 ByRef) 
System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) 
System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) 
System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) 
System.Web.Http.HttpServer+d__0.MoveNext() 
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Web.Http.HttpServer+d__0, System.Web.Http]](d__0 ByRef) 
System.Web.Http.HttpServer.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) 
System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken) 
System.Web.Http.WebHost.HttpControllerHandler+d__0.MoveNext() 
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.Web.Http.WebHost.HttpControllerHandler+d__0, System.Web.Http.WebHost]](d__0 ByRef) 
System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(System.Web.HttpContextBase) 
System.Web.TaskAsyncHelper.BeginTask(System.Func`1, System.AsyncCallback, System.Object) 
System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef) 
System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception) 
System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback) 
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext) 
System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32) 
System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)

Here full memory analysis log file. 因此,正如我所理解的那样,异常从.Net LINQ实现中抛出。 任何人都可以帮助理解这个错误的原因以及如何避免它?

修改

我尝试过安装操作系统更新,但仍然发生异常。 所以今天我重写了这段代码。但今天错误出现在另一个地方:

 System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) 
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) 
   System.Delegate.DynamicInvokeImpl(System.Object[]) 
   NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NHibernate.Linq.NhLinqExpression, NHibernate.IQuery, NHibernate.Linq.NhLinqExpression) 
   NHibernate.Linq.DefaultQueryProvider.Execute(System.Linq.Expressions.Expression) 
   NHibernate.Linq.DefaultQueryProvider.Execute[[System.Nullable`1[[System.Int64, mscorlib]], mscorlib]](System.Linq.Expressions.Expression) 
   System.Linq.Queryable.SingleOrDefault[[System.Nullable`1[[System.Int64, mscorlib]], mscorlib]](System.Linq.IQueryable`1>) 
   WebCash.DAL.Entities.EntitiesExtensions.HasActiveLicense(WebCash.DAL.Entities.Cashbox) 

1 个答案:

答案 0 :(得分:1)

通过将.Net框架版本更新为4.6来解决问题。