Copied to clipboard

Flag this post as spam?

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


  • Veronica Burd 76 posts 201 karma points
    Feb 12, 2016 @ 13:48
    Veronica Burd
    0

    ApplicationEvents firing twice in 7.4.0

    Hi All,

    I just upgraded my site to 7.4.0 and have found that code in OnApplicationStarted and OnApplicationInitialized events gets called twice.

    Here's a simplified OnApplicationInitialized

        public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, 
            ApplicationContext applicationContext) {
    
            //Add handler to intercept media pickers to allow us to set start point according to parent's settings
            GlobalConfiguration.Configuration.MessageHandlers.Add(new cmsHoR.App_Code.MediaPickerExtension());
            LogHelper.Info<ParliamentEvents>("Added Web handler for MediaPickerExtension");
    }
    

    When recycling the App pool I can see that this line gets logged twice:

    "Added Web handler for MediaPickerExtension"

    Is anyone else seeing this?

    TIA

    Ver

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Feb 12, 2016 @ 14:50
    Stefan Kip
    100

    Just tested this with this code:

    protected override void ApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
        base.ApplicationInitialized(umbracoApplication, applicationContext);
    
        LogHelper.Error(GetType(), "Test", new Exception("Test"));
    }
    

    It gets logged only once for me.

  • Veronica Burd 76 posts 201 karma points
    Feb 12, 2016 @ 14:56
    Veronica Burd
    0

    Hmm. Seems part of my web.config got mangled in the upgrade process and I had semi-colon in one of my entries under system.web.webPages.razor/pages/namespaces in the Views/web.config.

    Thanks for testing and letting me know.

    Regards

Please Sign in or register to post replies

Write your reply to:

Draft