简体   繁体   English

Hangfire:线程正在中止

[英]Hangfire: Thread was being aborted

I am using hangfire for background tasks, however a lot of times I'm hit with a following exception: 'System.Threading.ThreadAbortException: Thread was being aborted'. 我正在使用hangfire进行后台任务,但很多时候我遇到了以下异常:'System.Threading.ThreadAbortException:Thread is aborted'。 This happens in random code places that are exectued withing the background tasks, sometimes in the middle, sometimes at the end of those methods, which are in a result partially completed. 这种情况发生在随机代码的地方,这些代码地点与背景任务相关,有时在中间,有时在这些方法的末尾,结果部分完成。 How I should handle such a thing? 我该怎么处理这样的事情? How i should code around it, or stop it from happening? 我应该如何围绕它编码,或阻止它发生?

how are you hosting Hangfire? 你是如何主持Hangfire的? I had issues (but eventually managed to resolve them) when hosting Hangfire in IIS. 在IIS中托管Hangfire时,我遇到了问题(但最终设法解决了这些问题)。 One place to look for errors is in the Windows EventViewer. 查找错误的一个地方是Windows EventViewer。 Current guess is that the parent thread was stopped (either from IIS or some exception). 目前的猜测是父线程已停止(来自IIS或某些异常)。

Also, Hangfire uses the DEBUG log4net logger. 此外,Hangfire使用DEBUG log4net记录器。 You can use that to get more detailed error logs from Hangfire. 您可以使用它来从Hangfire获取更详细的错误日志。

Without more detailed information, that is all I can contribute. 没有更详细的信息,这就是我所能做出的贡献。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM