ASP MVC: When is IController Dispose() called?

前端 未结 2 1879
梦如初夏
梦如初夏 2020-11-30 20:51

I\'m going through a big refactoring / speed tweaking of one of my larger MVC apps. It has been deployed to production for a few months now, and I was starting to get timeo

2条回答
  •  孤城傲影
    2020-11-30 21:49

    Dispose is called after the view is rendered, always.

    The view is rendered in the call to ActionResult.ExecuteResult. That's called (indirectly) by ControllerActionInvoker.InvokeAction, which is in turn called by ControllerBase.ExecuteCore.

    Since the controller is in the call stack when the view is rendered, it cannot be disposed then.

提交回复
热议问题