首页 > 解决方案 > System.OutOfMemoryException - Windows 服务自动停止

问题描述

我编写了一个 Windows 服务,它处理数据库中的记录并更新某些业务线

使用 C# .NET 开发的应用程序

我正在低于事件查看器中捕获的内容

应用程序错误:

Faulting application name: MyService.WindowsService.exe, version: 1.0.19092.2, time stamp: 0x5ca328e2
Faulting module name: clrjit.dll, version: 4.7.3260.0, time stamp: 0x5bb7bb2d
Exception code: 0xc0000005
Fault offset: 0x00004a00
Faulting process id: 0x1c8c
Faulting application start time: 0x01d4ee42fa584c7d
Faulting application path: C:\MyService\WindowsService\1.0.19092.2_1\WindowsService.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll
Report Id: a4f89c01-ef37-41f5-abdf-d2c8c43d72d1
Faulting package full name: 

.Net 运行时:

Application: MyService.WindowsService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.OutOfMemoryException
   at System.Threading.Monitor.ObjPulseAll(System.Object)
   at System.Threading.Monitor.PulseAll(System.Object)
   at Serilog.Sinks.PeriodicBatching.PortableTimer+<OnTick>d__8.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_1(System.Object)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

应用程序错误:

Faulting application name: MyService.WindowsService.exe, version: 1.0.19092.2, time stamp: 0x5ca328e2
Faulting module name: clrjit.dll, version: 4.7.3260.0, time stamp: 0x5bb7bb2d
Exception code: 0xc0000005
Fault offset: 0x00004a00
Faulting process id: 0x15e8
Faulting application start time: 0x01d4edcca1fc92f8
Faulting application path: C:\Service\WindowsService\1.0.19092.2_1\MyService.WindowsService.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll
Report Id: b4f4f164-bdbd-4ed8-a076-b27fbda45927
Faulting package full name:

.Net 运行时:

Application: MyService.WindowsService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException

我如何追踪它?

标签: c#memorymemory-leaks

解决方案


推荐阅读