C# hangfire stopping

Asked

Viewed 897 times

1

I’m using hangfire with IIS in an Asp.net MVC application with C#. I have a Task running every 5 minutes, but the application is stopping.

This occurs in a variable time period, sometimes runs for 3 hours and sometimes for less time, but if the browser is open in the application this does not stop.

Has anyone been there, or has any idea what it might be?

public void Preload(string[] parameters)
{
    HangfireBootstrapper.Instance.Start();
}



public class HangfireBootstrapper : IRegisteredObject
{
    public static readonly HangfireBootstrapper Instance = new HangfireBootstrapper();
    private readonly object _lockObject = new object();
    private bool _started;

    private BackgroundJobServer _backgroundJobServer;

    private HangfireBootstrapper()
    {
    }

    public void Start()
    {
        lock (_lockObject)
        {
            if (_started) return;
            _started = true;

            HostingEnvironment.RegisterObject(this);

            var options = new SqlServerStorageOptions();
            options.QueuePollInterval = TimeSpan.FromSeconds(28);

            GlobalConfiguration.Configuration.UseSqlServerStorage("DatabaseContext", options);

            var ioc = new IoC();
            var kernel = ioc.Kernel;
            kernel.Bind<IConnectionStringProvider>().To<DatabaseResolver>();

            GlobalConfiguration.Configuration.UseNinjectActivator(kernel);

            _backgroundJobServer = new BackgroundJobServer();

            RecurringJob.AddOrUpdate("Job", () => new RecurringJobs().SempreAlerta(), Cron.Hourly);
        }
    }

    public void Stop()
    {
        lock (_lockObject)
        {
            _backgroundJobServer?.Dispose();

            HostingEnvironment.UnregisterObject(this);
        }
    }

    void IRegisteredObject.Stop(bool immediate)
    {
        Stop();
    }

RecurringJobs.cs

    [DisableConcurrentExecution(6000)]
    public void SempreAlerta()
    {
        BackgroundJob.Enqueue(() => new Processos().SempreAlerta());
    }

Global.asax

public class MvcApplication : HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);

        HangfireBootstrapper.Instance.Start();
    }

    protected void Application_End(object sender, EventArgs e)
    {
        HangfireBootstrapper.Instance.Stop();
    }
}

Below is the configuration I use on IIS and the application log.

Iis configuration

2016-07-15 07:59:46.5802 Info System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2 - Start installing Hangfire SQL objects...
2016-07-15 07:59:47.3162 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Hangfire SQL objects installed.
2016-07-15 07:59:49.5102 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Starting Hangfire Server
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Using job storage: 'SQL Server: srv-sql-1-001@DBXXXXX'.
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Using the following options for SQL Server job storage:
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log -     Queue poll interval: 00:00:28.
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Using the following options for Hangfire Server:
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log -     Worker count: 40.
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log -     Listening queues: 'default'.
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log -     Shutdown timeout: 00:00:15.
2016-07-15 07:59:49.5182 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log -     Schedule polling interval: 00:00:15.
2016-07-15 07:59:49.5682 Debug System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2 - Background process 'BackgroundProcessingServer' started.
2016-07-15 07:59:50.3222 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'ServerHeartbeat' started.
2016-07-15 07:59:50.3222 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'ServerWatchdog' started.
2016-07-15 07:59:50.3222 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Hangfire.SqlServer.ExpirationManager' started.
2016-07-15 07:59:50.3222 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Hangfire.SqlServer.CountersAggregator' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e828e310' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #126ccf85' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ee26b249' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #38e5eea2' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #2c691c7a' started.
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Aggregating records in 'Counter' table...
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Removing outdated records from table 'AggregatedCounter'...
2016-07-15 07:59:50.3262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b150c94f' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #926f8d0f' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7c626ecd' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ff0a5d7f' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #1cb20507' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #eb04e219' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e0046a00' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #9547b5ee' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #03aedeae' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #a837b3b3' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ec4ad920' started.
2016-07-15 07:59:50.3572 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #91b41f78' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b332153e' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #06f18034' started.
2016-07-15 07:59:50.3572 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6dcb6dda' started.
2016-07-15 07:59:50.3452 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6fb229f7' started.
2016-07-15 07:59:50.3572 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #04362bb2' started.
2016-07-15 07:59:50.3572 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e1103b27' started.
2016-07-15 07:59:50.3572 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #f9d5765b' started.
2016-07-15 07:59:50.3752 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #55f53d3e' started.
2016-07-15 07:59:50.3752 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b2d64e6a' started.
2016-07-15 07:59:50.3752 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7121ba9a' started.
2016-07-15 07:59:50.3752 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #0dfaf287' started.
2016-07-15 07:59:50.3902 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #8d2113b8' started.
2016-07-15 07:59:50.3752 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #f3c0126e' started.
2016-07-15 07:59:50.4262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e97e2dba' started.
2016-07-15 07:59:50.4412 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #399dbcc1' started.
2016-07-15 07:59:50.4262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #14a3019f' started.
2016-07-15 07:59:50.4412 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7b1af3fe' started.
2016-07-15 07:59:50.4262 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #dfbf8614' started.
2016-07-15 07:59:50.4582 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6fd81085' started.
2016-07-15 07:59:50.4582 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #c902029f' started.
2016-07-15 07:59:50.4582 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #3dda2fde' started.
2016-07-15 07:59:50.4662 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #a57bc97d' started.
2016-07-15 07:59:50.4662 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'DelayedJobScheduler' started.
2016-07-15 07:59:50.4662 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'RecurringJobScheduler' started.
2016-07-15 07:59:50.4582 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #43d2c8e7' started.
2016-07-15 07:59:50.4832 Trace System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2 - Removed 1 outdated record(s) from 'AggregatedCounter' table.
2016-07-15 07:59:51.4862 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Removing outdated records from table 'Job'...
2016-07-15 07:59:51.5112 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Removing outdated records from table 'List'...
2016-07-15 07:59:51.5162 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Removing outdated records from table 'Set'...
2016-07-15 07:59:51.5162 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Removing outdated records from table 'Hash'...
2016-07-15 08:00:18.4982 Info Portal.Services.Jobs.RecurringJobs.RecurringJobs.EnviarInfoProcessoFaturarXXXXX - Chamou VerificarEnviarProcessosParaFaturarXXXXX
2016-07-15 08:00:54.9030 Info Portal.Services.Jobs.Integradores.Processos.VerificarEnviarProcessosParaFaturarXXXXX - INICIO controleProcessos
2016-07-15 08:00:54.9811 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:00:54.9811 Info Portal.Services.Jobs.Integradores.Processos.VerificarEnviarProcessosParaFaturarXXXXX - PROCESSANDO controleProcessos -> A ENVIAR: 0
2016-07-15 08:00:54.9811 Info Portal.Services.Jobs.Integradores.Processos.VerificarEnviarProcessosParaFaturarXXXXX - FIM controleProcessos
2016-07-15 08:01:14.5839 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:02:10.9592 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:03:06.6470 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:04:02.7408 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:04:50.4127 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Aggregating records in 'Counter' table...
2016-07-15 08:05:03.1001 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:06:03.7407 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:07:01.8033 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:08:14.7720 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:09:10.7408 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:09:50.4439 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Aggregating records in 'Counter' table...
2016-07-15 08:10:06.7407 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:11:02.7564 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:12:03.3658 Info Portal.Services.Jobs.Integradores.Processos.SempreAlerta - PENDENTES SempreAlerta -> A ENVIAR: 0
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'ServerWatchdog' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #1cb20507' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e828e310' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6fd81085' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #126ccf85' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #3dda2fde' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Hangfire.SqlServer.ExpirationManager' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'DelayedJobScheduler' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #14a3019f' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e0046a00' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7121ba9a' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'RecurringJobScheduler' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ec4ad920' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #f3c0126e' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6fb229f7' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #43d2c8e7' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #a57bc97d' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #eb04e219' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #a837b3b3' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #6dcb6dda' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7b1af3fe' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e1103b27' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #e97e2dba' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #2c691c7a' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b2d64e6a' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #dfbf8614' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b332153e' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #8d2113b8' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ff0a5d7f' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Hangfire.SqlServer.CountersAggregator' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #c902029f' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #9547b5ee' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #b150c94f' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #ee26b249' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #926f8d0f' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #38e5eea2' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #7c626ecd' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #55f53d3e' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #06f18034' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #f9d5765b' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #03aedeae' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #91b41f78' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #399dbcc1' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'ServerHeartbeat' stopped.
2016-07-15 08:12:32.6544 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #0dfaf287' stopped.
2016-07-15 08:12:32.6314 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'Worker #04362bb2' stopped.
2016-07-15 08:12:32.7407 Debug Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Background process 'BackgroundProcessingServer' stopped.
2016-07-15 08:12:32.7407 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Hangfire Server stopped.
2016-07-15 08:12:32.7876 Info Hangfire.Logging.LogProviders.NLogLogProvider+NLogLogger.Log - Hangfire Server stopped.
  • How’s the Hangfire Dashboard?

  • When you open the Dashboard the application starts working again, the problem occurs some time after closing the Dashboard. I believe it may be connected to the idleness of the application pool.

  • It’s not like that. It has the options that show if it failed, success, last time run, etc. I want to know if something is done, if it’s wrong, or if it just stops. Hangfire usually shows this

3 answers

1

So by default your Applicationpool on IIS comes with the idleTimeout property set to 20. IE, if your application stays 20 minutes without receiving any request, your Applicationpool is turned off until you receive a request.

0


The application has neither rentries nor failed, to it if the application pool does not receive requests.

Dashboard

I decided to create a windows service with a webrequest for Dashboard, so the application pool will receive the requests and will not stop for idleness.

I will adopt this alternative until I find a better solution.

Thank you all for your help and if anyone has a good idea or suggestion please do it here.

thanks again

0

The official documentation explains how to resolve this: http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

Basically, you need to change the "Start Mode" of the pool responsible for your site to "Alwaysrunning".

The document also describes a simple way to test whether the feature is working as it should.

The simplest method - Recycle your Application pool, Wait for 5 minutes, then go to the Hangfire Dashboard UI and check that Current Hangfire Server instance was Started 5 minutes ago.

Bottom line: manually recycle the site pool, wait 5 minutes, and make sure Dashboard says the hangfire instance started 5 minutes ago. (i.e., the pool was recycled manually, but returned alone without having to receive a request before starting again)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.