1

Does anybody known any objections from using ASP.NET method Application_Start for application warm-up?

Especially, for web-services, where is usually required to preload files, caches algorithms and etc.

Exist:

But, both methods require changes in IIS configuration for each application, what is uncomfortable in case with many-many applications and has additional risks on releases.

In accordance with ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0:

ASP.NET calls them (Application_Start and Application_End) once for the lifetime of the application domain, not for each HttpApplication instance.

Therefore, Application_Start seems like a great place for warm-up code, for example:

protected void Application_Start(object sender, EventArgs e)
{
    Task.Run(WarmUpBackend);
}

It requires only configure IIS App as AlwaysRunning. In WarmUpBackend we can preload everything what we need for web-services.

Nikita Danilov
  • 98
  • 1
  • 11

1 Answers1

0

You might be better off using a Service autostart provider.

Scott Guthrie has a blog post about this.

Joe
  • 122,218
  • 32
  • 205
  • 338
  • Joe, thanks, but why this approach is better than addresses this scenario, than Application_Start? My questions is related for warm-up some web-services, without requests to web-pages. Because for web-services usually the most expensive: queries to DB, files preloading into cache and etc. – Nikita Danilov Oct 26 '17 at 12:56