hangfire

.NET core: Hangfire setup with NLog

本小妞迷上赌 提交于 2019-12-11 17:54:49
问题 I have an .NET Core 2 powered API that I would like to add Hangfire to. The project is already using NLog to log to a MySQL database and it works fine, but when I try to setup and use Hangfire I get the following error: Method not found: 'Hangfire.Logging.ILog Hangfire.Logging.LogProvider.GetCurrentClassLogger()'. The Hangfire dashboard works, but I get that error when trying to enqueue my first job like this: BackgroundJob.Enqueue(() => Console.WriteLine("Fire-and-forget")); I have read the

EF Core with ABP performance issue in huge loops

旧巷老猫 提交于 2019-12-11 13:15:24
问题 I have a background job that processes a list of items. However, the larger the list, the time to complete it grows exponentially. Not just that, the further down the list, the app gradually eats up my server's 64gb ram and slows down the server to a crawl. I use Hangfire as my background job manager, and the job takes a list of id and performs multiple database actions on them. I access the database through ef core, using the repository pattern provided by aspnetboilerplate framework. I

Hangfire dashboard authorization in Azure WorkerRole OR Self Hosted application

99封情书 提交于 2019-12-11 11:48:23
问题 It is very recent that I have introduced to Hangfire, and I must say it is awesome. I am working on an application, wherein I am hosting hangfire in Azure worker role. Everything works perfect ; the hangfire configuration, job scheduling, dashboard etc. except configuring authorization to hangfire dashboard . I have added an OwinStartup class where I have configuring hangfire dashboard. I have used my custom implementation of IAuthorizationFilter and an OwinMiddleware , anticipating that user

Stop recurring jobs (Hangfire) before deployment to production environment

安稳与你 提交于 2019-12-11 03:07:02
问题 Is there a way to stop the recurring jobs to run immediately when the server restart or right after the deployment is done? And If we delete the recurring job from the dashboard, how to add it again? Thanks 来源: https://stackoverflow.com/questions/54339426/stop-recurring-jobs-hangfire-before-deployment-to-production-environment

Resolving Hangfire dependencies/HttpContext in .NET Core Startup

允我心安 提交于 2019-12-10 12:45:54
问题 I've installed and configured Hangfire in my .NET Core web application's Startup class as follows (with a lot of the non-Hangfire code removed): public class Startup { public void Configuration(IAppBuilder app) { app.UseHangfireServer(); //app.UseHangfireDashboard(); //RecurringJob.AddOrUpdate(() => DailyJob(), Cron.Daily); } public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddOptions(); services.Configure<AppSettings>(Configuration); services.AddSingleton

Object getting Null seems like deserialization issue in Hangfire

守給你的承諾、 提交于 2019-12-10 10:44:13
问题 It seems like Hangfire is unable to deserialize my original Scheduler object with all its state, whose Execute method I am calling in BackgroundJob.Enqueue() as shown below: Scheduler = new FileInFileOut { FileIn = new FileInput() { FileName = "SampleInput.txt", DirectoryPath = @"C:\Users\LENOVO\Desktop\iRule", FileFormat = new System.Collections.Generic.Dictionary<string, string> { {"X", "ParseInt(input.Substring(0, 2))"}, {"Y", "ParseInt(input.Substring(3, 2))"}, {"Z", "ParseInt(input

How do I get the current attempt number on a background job in Hangfire?

為{幸葍}努か 提交于 2019-12-10 04:22:40
问题 There are some database operations I need to execute before the end of the final attempt of my Hangfire background job (I need to delete the database record related to the job) My current job is set with the following attribute: [AutomaticRetry(Attempts = 5, OnAttemptsExceeded = AttemptsExceededAction.Delete)] With that in mind, I need to determine what the current attempt number is, but am struggling to find any documentation in that regard from a Google search or Hangfire.io documentation.

Hangfire Dashboard Authorization Config Not working

筅森魡賤 提交于 2019-12-08 15:13:24
问题 I've downloaded the nu-get package Hangfire.Dashboard.Authorization I'm trying configure the OWIN based authorization as per the docs as follows but I get intellisense error DashboardOptions.AuthorizationFilters is obsolete please use Authorization property instead I also get intellisense error The type or namespace AuthorizationFilter and ClaimsBasedAuthorizationFilterd not be found using Hangfire.Dashboard; using Hangfire.SqlServer; using Owin; using System; namespace MyApp { public class

Using Postal and Hangfire in Subsite

吃可爱长大的小学妹 提交于 2019-12-07 23:44:37
问题 I have been trying to use Postal on my MVC5 site. When I host my webpage a subsite ie, http://localhost/Subsite I am receiving the error The virtual path '/' maps to another application, which is not allowed I have debugged it down to when the ControllerContext is being created the HttpContext isn't getting set correctly. Since I'm running Postal from Hangfire the HttpContext.Current is always null. Postal creates the ContollerContext using the code below. ControllerContext

Keep history of jobs executed for more than 1 day in Hangfire

前提是你 提交于 2019-12-07 07:05:21
问题 I've just started using Hangfire, and I am loving it. I understand that Hangfire maintains the history for succeeded jobs for 1 day, and clear it thereafter. Is there is a way where I can customize this default behavior and persist the history for any duration say 7 days? 回答1: To do this, you need to create a job filter and register it through hangfire global configurations, as discussed here - https://discuss.hangfire.io/t/how-to-configure-the-retention-time-of-job/34 Create job filter -