– Web API: Why are controllers created per request

Mike Wasson's article "Dependency Injection for Web API Controllers" on says:

Dependenecy Scope and Controller Lifetime

Controllers are created per request…

Am I correct in understanding that ASP.NET Web API creates a new controller instance (and satisfies its dependencies) for each incoming request?

Is this approach not wasteful in that it creates and destroys many instances of the controller when in theory a single instance could be used for all requests?

Best Solution

A controller contains information (state) about the incoming request.

If you had only one controller to handle many requests then they would all be confused and users would likely get some strange results.

Related Question