ThreadAbortException in a long running job

Tags: #<Tag:0x00007fafedd63950>

Hi, I have a function (f1) which performs some task (30 mins task), the function calls another function (f2) from an external assembly and submits another job to a cluster (this one takes sometime, few mins). I have put f2 in a try-catch block, but after few seconds, I get ThreadAbortException. Can you please help?

// from my controller
public ActionResult NewRequest() 
{
BackgroundJob.Enqueue(() => f1());
}

[AutomaticRetry(Attempts = 0, DelaysInSeconds = new int[] { 3600 }, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public void f1()
{
//calls f2
try
{
f2()
}
catch
{
// getting ThreadAbortException  here
}
}

Have you made sure your IIS isn’t going to idle state?

image

Full article:

If you’ve already done that, could you provide your full exception trace here.