Hi. I am deploying an application that uses Hangfire in azure hosting (app and database). When I run my app pointing to that azure hosted database it gives me the following error:
Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN.
Global.asax configuration:
//Configuración de Hangfire
Hangfire.GlobalConfiguration.Configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseColouredConsoleLogProvider()
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(“HangfireEntities”, new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
UsePageLocksOnDequeue = true,
DisableGlobalLocks = true
});
var MonitorHangfire = JobStorage.Current.GetMonitoringApi();
//Recurring Jobs
JobStorage.Current.GetConnection().GetRecurringJobs().ForEach(x => RecurringJob.RemoveIfExists(x.Id)); // this line changed!
//Processing Jobs
MonitorHangfire.ProcessingJobs(0, int.MaxValue).ForEach(x => BackgroundJob.Delete(x.Key));
//Scheduled Jobs
MonitorHangfire.ScheduledJobs(0, int.MaxValue).ForEach(x => BackgroundJob.Delete(x.Key));
//Enqueued Jobs
MonitorHangfire.Queues().ToList().ForEach(x => MonitorHangfire.EnqueuedJobs(x.Name, 0, int.MaxValue).ForEach(y => BackgroundJob.Delete(y.Key)));
Servidor = new BackgroundJobServer();
I hope you can help. Thank you!