Looking for complete VB.Net implementation example

redis
recurring
Tags: #<Tag:0x00007f499ba60248> #<Tag:0x00007f499ba67ef8>

#1

Greetings to the forum.

I have been tasked with adding overnight jobs to a legacy VB.Net (.NET 4.6.1) ASP.NET MVC application.

I have been able to run the HangFire startup process and on the development environment the jobs fire overnight and the Hangfire Dashboard is all good. The problem comes when the application is published to our live IIS 10 server. Nothing happens. I know the Dashboard should not work, but the jobs just don’t fire.

So I’m looking for a solution to why this (doesn’t) happen. I’m hoping there’s a complete example implementation in VB.Net somebody could point me at.

Currently I have a “HangFire” Connection string in web.config. I have a public shared function named “HangFireBuildJob()” in my HomeController, and my “Startup.vb” is below. What am I missing?

Imports Hangfire
Imports Hangfire.SqlServer
Imports Microsoft.Owin
Imports Owin

<Assembly: OwinStartup(GetType(Global.Startup))>

Namespace Global
Public Class Startup


    Public Sub Configuration(app As IAppBuilder)

        GlobalConfiguration.Configuration.UseSqlServerStorage("HangFire")
        Dim options = New DashboardOptions With {.AppPath = VirtualPathUtility.ToAbsolute("~")}
        app.UseHangfireDashboard("/hangfire", options)
        app.UseHangfireServer()

        RecurringJob.AddOrUpdate(Function() HomeController.HangfireBuildJob(), Cron.Daily)
    End Sub

End Class
End Namespace