1

Estou utilizando o hangfire com IIS em uma aplicação asp.net MVC com C#. tenho uma Task rodando a cada 5 minutos, porém a aplicação está parando.

Isso ocorre em um período de tempo variável, as vezes roda por 3 horas e as vezes por menos tempo, porém se o browser estiver aberto na aplicação esta não para.

Alguém já passou por isso, ou tem alguma ideia do que possa ser?

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();
    }
}

Abaixo tem a configuração que utilizo no IIS e o log da aplicação.

Configuração do iis

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.
3
  • Como está o dashboard do Hangfire?
    – Randrade
    Commented 15/07/2016 às 17:30
  • Ao abrir o Dashboard a aplicação volta a funcionar, o problema se verifica algum tempo depois de fechar o dashboard. Creio que possa estar ligado a ociosidade do application pool.
    – ntfrigo
    Commented 15/07/2016 às 17:36
  • Não é isso. Ele possui as opções que mostram se falhou, sucesso, ultima vez executa, etc. Quero saber se algo é feito, se da erro ou se simplesmente para. O Hangfire mostra isso normalmente
    – Randrade
    Commented 15/07/2016 às 17:38

3 Respostas 3

1

Então, por padrão seu ApplicationPool no IIS vem com a propriedade idleTimeout definido para 20. OU seja, se a sua aplicação ficar 20 minutos sem receber nenhum request, o seu ApplicationPool é desligado até receber um request.

0

A aplicação não tem rentries nem failed, a ela para se o application pool não receber requisições.

Dashboard

Decidi criar um serviço do windows com uma webrequest para o dashboard, assim o application pool receberá as requisições e não irá parar por ociosidade.

Vou adotar esta alternativa até encontrar uma solução melhor.

Obrigado a todos pela ajuda e se alguém tem uma boa ideia ou sugestão por favor, façam aqui.

obrigado novamente

0

A documentação oficial explica como resolver isso: http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

Basicamente, você precisa alterar o "Start Mode" do pool responsável pelo seu site para "AlwaysRunning".

O documento também descreve uma maneira simples de testar se o recurso está funcionando como deveria.

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.

Resumindo: recicle manualmente o pool do site, aguarde 5 minutos e verifique se no dashboard diz que a instância do hangfire foi iniciada há 5 minutos atrás. (ou seja o pool foi reciclado manualmente, mas retornou sozinho sem precisar receber uma requisição antes de iniciar novamente)

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .