我的服务在随机的时间内工作得很好,然后就停止了。
我正在捕捉我能看到的所有异常。我在服务创建周围添加了一个 try/catch 来尝试得到某种错误,但我什么也没得到。服务刚刚停止。
try
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] { new my_service() };
ServiceBase.Run(ServicesToRun);
}
catch (Exception e)
{
logEvent(e); // Log any errors to a .txt file.
}
事件查看器显示以下内容:
Faulting application name: my_service.exe, version: 0.9.2.1, time stamp: 0x50717154
Faulting module name: ntdll.dll, version: 6.1.7601.17514, time stamp: 0x4ce7b96e
Exception code: 0xc0000005
Fault offset: 0x00055f99
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13