I need some help with error using multiple servers in the same dashboard

Hi!

I need some help using multiple servers in the same dashboard.

My dashboard give an error after 5-6 minutes after execute my application, only in the realtime graph / history graph page, all the other pages works well only the graph monitoring page that gives the following error:

This only happen when i use multiple servers, if i use a single server the error dont happen.

This is an bug or the application cannot working in that way?

This is my startup code:

  public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        public void ConfigureServices(IServiceCollection services)
        {

            services.AddHangfire(x => x.UseMemoryStorage());                                

            services.AddHangfireServer(options => {
                
                options.Queues = new[] { "jobobterimagenshoje" };
                options.ServerName = "ObterImagensHoje";
                options.WorkerCount = 1;
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobobterimagensanteriores" };
                options.ServerName = "ObterImagensAnteriores";
                options.WorkerCount = 1;
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobobterimagens" };
                options.ServerName = "ObterImagens";
                options.WorkerCount = 5;
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobobterarquivosparaenvio" };
                options.ServerName = "ObterArquivosParaEnvio";
                options.WorkerCount = 1;
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobenviararquivos" };
                options.ServerName = "EnviarArquivos";
                options.WorkerCount = Convert.ToInt32(Configuration["quantidadeDeJobsEnviandoArquivos"]);
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobmontarpacotes" };
                options.ServerName = "MontarPacotes";
                options.WorkerCount = Convert.ToInt32(Configuration["quantidadeDeJobsMontandoPacotes"]);
            });

            services.AddHangfireServer(options => {
                options.Queues = new[] { "jobcompactararquivos" };
                options.ServerName = "CompactarArquivos";
                options.WorkerCount = Convert.ToInt32(Configuration["quantidadeDeJobsCompactandoArquivos"]);
            });

            DependencyInjection.Configure(services, Configuration);
            services.AddControllers();            
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {                                
                AppPath = null
            });

            app.UseSerilogRequestLogging();

            RecurringJob.AddOrUpdate<IRouterAppService>("ObterImagensHoje", x => x.ObterImagensHoje(), $"*/{Convert.ToInt32(Configuration["intervaloParaObterImagens"])} * * * *", TimeZoneInfo.Local, "jobobterimagenshoje");
            RecurringJob.AddOrUpdate<IRouterAppService>("ObterImagensAnteriores", x => x.ObterImagensAnteriores(), $"*/{Convert.ToInt32(Configuration["intervaloParaObterImagens"])} * * * *", TimeZoneInfo.Local, "jobobterimagensanteriores");
            RecurringJob.AddOrUpdate<IRouterAppService>("ObterArquivosParaEnvio", x => x.ObterArquivosParaEnvio(), $"*/{Convert.ToInt32(Configuration["intervaloParaEnvioDeImagens"])} * * * *", TimeZoneInfo.Local, "jobobterarquivosparaenvio");

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();                
            });
        }
    }
1 Like