public void ConfigureServices(IServiceCollection services)
{
// Add Hangfire services.
services.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage({my-connection-string},
new SqlServerStorageOptions
{
PrepareSchemaIfNecessary = true,
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
UsePageLocksOnDequeue = true,
DisableGlobalLocks = true
}));
services.AddHangfireServer();
}
However when I invoke a Hangfire task :
BackgroundJob.Schedule(
() => CheckUpload({my-data}),
TimeSpan.FromSeconds({my-interval}));
I receive this error :
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
But I would think this was taken care of by my UseSqlServerStorageOptions
init.