Scheduled Jobs inside a newly created batch does not run unless hangfire is restarted

The code is something like:

BatchJob.StartNew(action => { Class1.RunJob(action); });

Inside the Class1.RunJob function, there are other classes that utilize the IBatchAction to schedule their own jobs if needed. What I call is action.Schedule() function.

Looking at the Dashboard, the Batch and the Jobs scheduled in it is properly created although all the scheduled Jobs does not run until I restart the server.

Is there a code that I need to execute to notify that the Batch creation is done and should proceed with picking up the scheduled jobs inside of it? All scheduling is inside the batch since the requirement is that the job is only successful if all expected jobs are properly created and scheduled.

No special action is required here, and looks like your application was simply deactivated in IIS due to idle timeout or something like this. Have you implemented the auto-start feature described here? If yes, then some more information and dashboard screenshots required.

Sorry for the late reply, the priority was re-ordered and I was not able to go back to this issue.

I’m just running the application in debug mode from Visual Studio and the application is just hosted in an IIS Express opened by the IDE. I tried leaving the application running overnight and noticed that after creating the batches, I’m still able to add jobs but encountered errors when hangfire was trying to queue them.

It looks as if the Batch blocks the jobs that it scheduled.