An exception was thrown by a TaskScheduler. Hangfire


#1

I’m getting exception while creating enqueue job (Multiple at a time, that is more than 100 jobs).

Message: An exception was thrown by a TaskScheduler.
StackTrace: at System.Threading.Tasks.Task.ScheduleAndStart(Boolean needsProtection)
at System.Threading.Tasks.Task.InternalStartNew(Task creatingTask, Delegate action, Object state, CancellationToken cancellationToken, TaskScheduler scheduler, TaskCreationOptions options, InternalTaskOptions internalOptions, StackCrawlMark& stackMark)
at System.Threading.Tasks.TaskFactory.StartNew(Action action, TaskCreationOptions creationOptions)
at Hangfire.Server.ServerProcessExtensions.CreateTask(IServerProcess process, BackgroundProcessContext context)
at Hangfire.Server.BackgroundProcessingServer…ctor(JobStorage storage, IEnumerable1 processes, IDictionary2 properties, BackgroundProcessingServerOptions options)
at Hangfire.BackgroundJobServer…ctor(BackgroundJobServerOptions options, JobStorage storage, IEnumerable`1 additionalProcesses)
at Hangfire.BackgroundJobServer…ctor()
Source: mscorlib
TargetSite: Void ScheduleAndStart(Boolean)


#2

Shouldn’t be a problem. I’ve tested thousands of scheduled jobs in minutes. You might want to post an example of your code.