How to avoid passing slow Application_Start times to the end users in ASP.NET

appharbor, asp.net-mvc-3, global-asax, iis-7, ioc-container

Solution

Unfortunately, a longer session timeout will not prevent an IIS app pool recycle when you're using InProcess session state.

Have you considered lazy loading (some of) your dependencies? SimpleInjector has documentation on how to do this, which should be adaptable to most other IoCs:

Simple Injector \ Documentation \ How To \ Register Factory Delegates \ Working With Lazy Factories

Problem

I have quite a slow Application_Start due to having a lot of IoC stuff happen at start up. The problem I'm trying to solve is, how do I avoid passing that start up time to the end user? Assumptions My apps are hosted on AppHarbor so I have no access to IIS. However even if I did, my understudying is that it's best practice to let the app pool recycle, so there's no way to avoid having the Application_Start run regularly (I think it's every 20 minutes on AppHarbor). My idea to solve it Initially I thought I'd hit it every minute or something, but that seems too brute force and it may not even stop a user from experiencing the slow start up. My current solution is to handle the Application_End event, and then immediately hit the App so that it starts up again, thus hopefully not impacting any users. Is there a better way to solve this issue?

Original source

Related problems