hangfire

Hangfire - Multi tenant, ASP.NET Core - Resolving the correct tenant

只愿长相守 提交于 2019-12-01 01:37:34
I got a SaaS project that needs the use Hangfire. We already implemented the requirements to identify a tenant. Architecture Persistence Layer Each tenant has it's own database .NET Core We already have a service TenantCurrentService which returns the ID of the tenant, from a list of source [hostname, query string, etc] We already have a DbContextFactory for Entity Framework which return a DB context with the correct connection string for the client We are currently using ASP.NET Core DI (willing to change if that helps) Hangfire Using single storage (eg: Postgresql), no matter the tenant

.Net framework to manage background running processess on seperate machines

爱⌒轻易说出口 提交于 2019-11-30 03:32:47
问题 I am having an asp.mvc application which resides on a server.From this application, I want to start a process which is a bit long-running operation and will be resource intensive operation. So what I want to do is I want to have some user agent like 3 which will be there on 3 machines and this user agent will use resources of their respective machines only. Like in Hadoop we have master nodes and cluster in which tasks are run on the individual cluster and there is 1 master node keeping track

Hangfire dependency injection lifetime scope

妖精的绣舞 提交于 2019-11-30 01:51:19
I'm rewriting this entire question because I realize the cause, but still need a solution: I have a recurring job in Hangfire that runs every minute and check the database, possibly updates some stuff, then exits. I inject my dbcontext into the class containing the job method. I register this dbcontext to get injected using the following builder.RegisterType<ApplicationDbContext>().As<ApplicationDbContext>().InstancePerLifetimeScope(); However, it seems that Hangfire does not create a seperate lifetime scope every time the job runs, because the constructor only gets called once, although the

Hangfire server unable to pick job in case of strategy design pattern

做~自己de王妃 提交于 2019-11-29 11:47:20
I am having following application : 1) Mvc app : Hangfire client from where i will just enqueue jobs and host dashboard.This app will contains reference of my class library. 2) Console App : Hangfire server will live in this console application. 3) Class library : Shared library between hangfire server(Console app) and hangfire client(asp.net mvc) where my long running code will reside.Hangfire server will execute code of this library. I am having structure like below in Class library following strategy design pattern. Code taken from following : Reference: Interfaces: public interface

Where am I supposed to start persistent background tasks in ASP.NET Core?

一曲冷凌霜 提交于 2019-11-29 11:05:39
In my web application (ASP.NET Core), I want to run a job in the background that is listening to a remote server, calculating some results and pushing it to the client on Pusher (a websocket). I'm not sure where I'm supposed to start this task. Currently I start it at the end of public void Configure(IApplicationBuilder app, IHostingEnvironment env) in Startup.cs but I think there is something wrong about that, it doesn't make sense to start background jobs in a method called "Configure". I was expecting to find a Start method somewhere Also, when I try to use EF Core to generate initial

Configure cron job that is executing every 15 minutes on Hangfire

≡放荡痞女 提交于 2019-11-29 02:56:13
I am using Hangfire and like the software very much! But one thing I am missing is how to add a recurring job that executes every few minutes (e.g. every 15 minutes). Is there a way to achieve this? Currently I am using this approach: RecurringJob.AddOrUpdate(() => Console.Write("Recurring"), "*/15 * * * *"); And is working like a charm. Reference to my question in Hangfire forums: http://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533 Looking at Hangfire.Cron class I don't know if it's possible. A workaround would be to create four different schedules i.e:

Hangfire dependency injection lifetime scope

一世执手 提交于 2019-11-28 22:41:09
问题 I'm rewriting this entire question because I realize the cause, but still need a solution: I have a recurring job in Hangfire that runs every minute and check the database, possibly updates some stuff, then exits. I inject my dbcontext into the class containing the job method. I register this dbcontext to get injected using the following builder.RegisterType<ApplicationDbContext>().As<ApplicationDbContext>().InstancePerLifetimeScope(); However, it seems that Hangfire does not create a

Hangfire dependency injection with .net core

送分小仙女□ 提交于 2019-11-28 18:33:21
How can I use .net core's default dependency injection in Hangfire ? I am new to Hangfire and searching for an example which works with asp.net core. See full example on GitHub https://github.com/gonzigonz/HangfireCore-Example . Live site at http://hangfirecore.azurewebsites.net/ Make sure you have the Core version of Hangfire: dotnet add package Hangfire.AspNetCore Configure your IoC by defining a JobActivator . Below is the config for use with the default asp.net core container service: public class HangfireActivator : Hangfire.JobActivator { private readonly IServiceProvider

Why is Hangfire requiring authentication to view dashboard

一曲冷凌霜 提交于 2019-11-28 08:35:19
I am running HangFire within my MVC web app but whenever I try to navigate to http://MyApp/hangfire , it redirects me to my app's login page as though I am not logged in. I have not explicitly configured any requirements for authorization...e.g. I had the below in the web.config, but then took it out in attempts to get this to work. <location path="hangfire"> <system.web> <authorization> <allow roles="Administrator" /> <deny users="*" /> </authorization> </system.web> In theory, this is what I'd want, and when I log into my main web application, I will be logged in with an Administrator role

How to prevent a Hangfire recurring job from restarting after 30 minutes of continuous execution

喜欢而已 提交于 2019-11-28 03:31:43
问题 I am working on an asp.net mvc-5 web application, and I am facing a problem in using Hangfire tool to run long running background jobs. the problem is that if the job execution exceed 30 minutes, then hangfire will automatically initiate another job, so I will end up having two similar jobs running at the same time. Now I have the following:- Asp.net mvc-5 IIS-8 Hangfire 1.4.6 Windows server 2012 Now I have defined a hangfire recurring job to run at 17:00 each day. The background job mainly