We just updated hangfire from 1.3.4 to 1.5.3.
Our startup has changed from this:
private static void DoHangfire(IAppBuilder app)
{
var options = new BackgroundJobServerOptions
{
// Set thread count to 1
WorkerCount = 1
};
app.UseHangfire(config =>
{
config.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["JobsDB"].ConnectionString);
config.UseAuthorizationFilters(new HangfireDashboardAuthorizationFilter());
config.UseServer(options);
});
// Set retries to zero
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });
JobActivator.Current = new WindsorJobActivator(Container.Kernel);
}
to this:
private static void DoHangfire(IAppBuilder app)
{
var options = new BackgroundJobServerOptions
{
// Set thread count to 1
WorkerCount = 1
};
GlobalConfiguration.Configuration.UseSqlServerStorage(
ConfigurationManager.ConnectionStrings["JobsDB"].ConnectionString);
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{
AuthorizationFilters = new List<IAuthorizationFilter>
{
new HangfireDashboardAuthorizationFilter()
}
});
app.UseHangfireServer(options);
// Set retries to zero
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });
JobActivator.Current = new WindsorJobActivator(Container.Kernel);
}
Now all our jobs (we have 4 different kinds of jobs) fail immediately with this error:
System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Hangfire.JobActivator.SimpleJobActivatorScope.Resolve(Type type) at Hangfire.Server.CoreBackgroundJobPerformer.Perform(PerformContext context) at Hangfire.Server.BackgroundJobPerformer.<>c__DisplayClass3.b__0() at Hangfire.Server.BackgroundJobPerformer.InvokePerformFilter(IServerFilter filter, PerformingContext preContext, Func1 continuation) at Hangfire.Server.BackgroundJobPerformer.PerformJobWithFilters(PerformContext context, IEnumerable
1 filters) at Hangfire.Server.BackgroundJobPerformer.Perform(PerformContext context) at Hangfire.Server.Worker.PerformJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)