Hangfire in .net core worker service


i’m trying to setup Hangfire in a .net core worker service.
It is working, but i am wondering about where to register jobs, not sure if program.cs is the right place ?
Anyone have any experience with this?
We have many potential tasks to run.

this is what i got so far from program.cs:

IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
        services.AddHangfire(x => x.UseSqlServerStorage(""));
        services.AddApplicationInsightsTelemetryWorkerService(new ApplicationInsightsServiceOptions()
            EnableAdaptiveSampling = false
    .ConfigureWebHostDefaults(builder =>
        builder.Configure(app =>
            // Schedule your Hangfire job here

            RecurringJob.AddOrUpdate<Test>("Test_ExecuteTask", job => job.ExecuteTest(), Cron.Minutely);

            // Hangfire dashboard options 

            DashboardOptions opt = new DashboardOptions();
            opt.DarkModeEnabled = true;
            opt.DashboardTitle = "Services Dashboard";
            opt.AppPath = null;

            app.UseHangfireDashboard("/hangfire", opt);
            app.UseEndpoints(endpoints =>


We just register them in the IOC container during startup.

We are using ServiceStack so our implementation might look a little different but the idea should be exactly the same:

appHost.GetContainer().RegisterAutoWiredAs<SomeJob, ISomeJob>();