When debugging a background job ... (https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers) ...If debug execution is terminated (i.e. at a breakpoint) before the job finishes, the background job attempts to continue where it left off when the debugger is started again.
How can I find the background job in the Task Manager and manually kill it? Or is there another way to kill the background job?
Also, how can I kill a running background job programmatically?
5 Answer(s)
-
0
the background job attempts to continue where it left off when the debugger is started again.
This is normal.
When you are debugging it, you can clear all background tasks when the application is launched.
Use
IRepository<BackgroundJobInfo, long>
to delete all task information. -
0
This answer is too cryptic. Please provide a more comprehensive answer.
-
0
hi tim,
do you mean to terminate the process of the background job? if so, open
CMD
and writetskill your-exe-file-name
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tskill -
0
How can I find the background job in the Task Manager and manually kill it?
You can inject the
IBackgroundJobStore
interface and call theGetWaitingJobsAsync
method. Of course, you can also useIRepository<BackgroundJobInfo, long>
to get more comprehensive task information, which exists in the database. Just like the implementation of BackgroundJobStore in the Abp.Zero.Common package.Or is there another way to kill the background job?
You can directly empty the
AbpBackgroundJobs
table in the database so that all tasks will disappear.Also, how can I kill a running background job programmatically?
You can use
IBackgroundJobManager
to delete a task, but the abp default implementation of the background task is relatively simple, if you need more advanced background task management, please consider using hangfire and other components.See: https://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers
-
1
@maliming- The code you posted (and deleted?) was very helpful, and has been incorporated into my app. It survives in the email announcement of your original reply.
@alper- RE:
tskill your-exe-file-name
What is my exe file name? It's apparently notmyapp-web.host.exe
. What am I looking for?RE: the other suggestions, it may be a few days or longer before I'm able to try your suggestions. I'll post the results here when available.