Using hangfire in Vb.net

dashboard
Tags: #<Tag:0x00007f6e3f41b748>

#1

Hi All,

I am new to HangFire and trying to implement hangfire in vb.net legacy code (web forms). I am using below code in new class file called startup.vb

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(ConfigurationManager.AppSettings("conString"))
        Dim options = New DashboardOptions With {.AppPath = VirtualPathUtility.ToAbsolute("~")}
        app.UseHangfireDashboard("/hangfire", options)
        app.UseHangfireServer()
    End Sub

End Class

End Namespace

I am getting 404 for http://localhost:2141/hangfire. Please help me if I am missing something.

I have looked at all the documents but could find anything helpful. Any help is appreciated.

Thanks :slight_smile:


Where to implement startup code in VB.Net project?
#2

Hello, if you haven’t figured it out yet, your fixed code is above… Note that the call to UseSqlServerStorage just needs the NAME of the connection string, the actual string as returned by ConfigurationManager.

Hope this helps!

–Jon