Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application lifetime in ASP.NET

This should be a simple question but I haven't managed to find the answer on google.

I would like to know, in terms an idiot can understand, exactly what application lifetime means in ASP.NET (and therefore when you can expect application start and end events to run).

I assumed it would be when you run and stop the app in IIS, but I've read things that suggest it's related to number of requests.

like image 702
fearofawhackplanet Avatar asked Jun 12 '10 12:06

fearofawhackplanet


People also ask

What is the lifetime of instance in .NET Core?

Scoped. The lifetime of the instance of scoped service is the lifetime of scope from which it is resolved. If a service instance is created, it is shared between middleware and controller. It is intermediate between transient & singleton.

What is ASP.NET Core lifecycle?

The ASP.NET Core MVC Request Life Cycle is a sequence of events, stages or components that interact with each other to process an HTTP request and generate a response that goes back to the client. In this article, we will discuss each and every stage of ASP.NET Core MVC Request Life Cycle in detail.

What is rendering in ASP.NET page life cycle?

During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream object of the page's Response property. The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded.

What is the start point of ASP.NET application?

The Startup class is the entry point to the application, setting up configuration and wiring up services the application will use. Developers configure a request pipeline in the Startup class that is used to handle all requests made to the application.


1 Answers

By default the lifetime starts with the first request to the app. And it ends after an idle timeout.

But this is configurable based on various things (including request count) in IIS.

And IIS7.5 has the ability to start an application when IIS starts, rather than waiting for the first request.

like image 140
Richard Avatar answered Sep 30 '22 15:09

Richard