ASP.net Web API: Why are controllers created per request?

前端 未结 2 1907
暖寄归人
暖寄归人 2020-12-08 03:09

Mike Wasson\'s article \"Dependency Injection for Web API Controllers\" on www.asp.net says:

Dependenecy Scope and Controller Lifetime

2条回答
  •  暖寄归人
    2020-12-08 03:50

    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.

提交回复
热议问题