Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controller life-cycle ASP.NET Core WebApi

Tags:

asp.net-core

I'm using asp.net core to develop a WebApi.

What is the life-cycle of controller in ASP.NET Core? Does it depends on the web server?

like image 454
Anas K Avatar asked May 13 '16 10:05

Anas K


People also ask

What is the life cycle of Web API?

The API lifecycle consists of three primary phases — create, control, and consume. In the create phase, you build and document your API. In the control phase, you apply security policies. And in the consume phase, you publish and monetize APIs.

What is the life cycle of ASP.NET Core?

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 difference between controller and API controller?

They work similarly in Web API, but controllers in Web API derive from the ApiController class instead of Controller class. The first major difference you will notice is that actions on Web API controllers do not return views, they return data. ApiControllers are specialized in returning data.

What is controller in ASP Net Web API?

In ASP.NET Web API, a controller is a class that handles HTTP requests. The public methods of the controller are called action methods or simply actions. When the Web API framework receives a request, it routes the request to an action. To determine which action to invoke, the framework uses a routing table.


1 Answers

Usually an instance of a controller is created per request and if you use dependency injection, all associated services are created for that request.

like image 86
Silthus Avatar answered Sep 20 '22 17:09

Silthus