Reputation: 804
I use SQL Server to store Hangfire data and self-written logger to log all stuff from Hangfire of my ASP.NET MVC 5 site. The problem is I can startup Hangfire, configure it, add new recurring job without any problems, but it just doesn't work (failed state in Hangfire.Job
table).
I use this OwinStartup
configuration:
public static void ConfigureHangfire(IAppBuilder app, string connectionName)
{
var options = new SqlServerStorageOptions
{
QueuePollInterval = TimeSpan.FromSeconds(10)
};
GlobalConfiguration.Configuration.UseSqlServerStorage(connectionName, options);
// Do not try to rerun failed jobs by default!
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });
// Add logs into passed log
LogProvider.SetCurrentLogProvider(new MyLogProvider()));
app.UseHangfireServer();
}
I have 2 questions:
Upvotes: 1
Views: 820
Reputation: 804
And I've found out answers to all questions:
First of all, my logging became work after I had commented this line:
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 0 });
I've tried to change Attempts to 1, but it still has not worked. Only full commenting of this code helped. Is this a bug? Frankly, I think so.
And after commenting I've got an opportunity to receive a problem message. And the problem is the class which owns called method isn't contains parameterless constructor.
Upvotes: 1