Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Greg Fyans 112 posts 271 karma points
    Feb 19, 2016 @ 10:47
    Greg Fyans
    0

    Hangfire.io with Umbraco 7.4.0

    I'm attempting to set up Hangfire in an existing Umbraco 7.4 site. I have my configuration class set up as so:

    [assembly: OwinStartup(typeof(HangfireStartup))]
    namespace Jobs
    {
        public class HangfireStartup
        {
            public void Configuration(IAppBuilder app)
            {
                GlobalConfiguration.Configuration.UseSqlServerStorage("hangfireDb");
    
                app.UseHangfireDashboard("");
    
                app.UseHangfireDashboard("/hangfire", new DashboardOptions
                {
                    AuthorizationFilters = new[] { new HangfireAuthorisationFilter() },
                    AppPath = "/umbraco/"
                });
    
                app.UseHangfireServer();
            }
        }
    }
    

    But this method is never called. The only way I can get my Configuration method to execute is if I remove the appSetting "owin:appStartup" which obviously borks Umbraco.

    What am I missing here?

  • Dirk De Grave 4533 posts 5979 karma points MVP 3x admin c-trib
    Feb 22, 2016 @ 09:43
    Dirk De Grave
    101

    You should be able to subclass UmbracoDefaultOwinStartup and call

    base.Configuration(app);
    

    before adding your own Hangfire code?

    Cheers, Dirk

  • Greg Fyans 112 posts 271 karma points
    Feb 22, 2016 @ 10:05
    Greg Fyans
    0

    Hmm, nope, still nothing. If you want to give this a shot I have a base Umbraco 7.4.1 install with Hangfire here:

    https://github.com/gfyans/UmbracoHangfire

    Here's my test class from that project:

    using System;
    using Owin;
    using Umbraco.Web;
    
    namespace Umbraco741Hangfire
    {
        public class OwinStartup : UmbracoDefaultOwinStartup
        {
            public override void Configuration(IAppBuilder app)
            {
                base.Configuration(app);
    
                Console.WriteLine("Setting up Hangfire...");
            }
        }
    }
    
  • Greg Fyans 112 posts 271 karma points
    Feb 22, 2016 @ 10:14
    Greg Fyans
    0

    Ahaha never mind, I forgot to update the appSetting to my new class:

    <add key="owin:appStartup" value="Umbraco741Hangfire.OwinStartup"/>
    

    That is it now working. Thanks!

  • Dirk De Grave 4533 posts 5979 karma points MVP 3x admin c-trib
    Feb 22, 2016 @ 10:21
    Dirk De Grave
    0

    Glad I could be of (little) help.

    --Dirk

Please Sign in or register to post replies

Write your reply to:

Draft