Copied to clipboard

Flag this post as spam?

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


  • nojaf 91 posts 300 karma points
    Feb 25, 2014 @ 11:54
    nojaf
    0

    ApplicationEventHandler ApplicationStarted times executed?

    I'm wonder how many times the ApplicationStarted event is triggered? IIS puts your application to "sleep" when inactive, will it trigger the event again when your first visitor is browing to the site and IIS is rebooting your application?

    public class RegisterEvents : ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            MyAwesomeMethod();
        }
    }
    

    I want to clean up nodes that are older than a day. I was thinking of doing it in the ApplicationStarted eventhandler instead of a scheduled task.

    Any ideas?

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Oct 25, 2015 @ 18:36
    Damiaan
    0

    Yes it will trigger every time.

    If you want to clean up, don't do it on application startup because that will make your startup slower. Scheduled tasks suit the job better.

Please Sign in or register to post replies

Write your reply to:

Draft