Introduce the Question个
我最近了解到,对ApiController
操作的调用将触发DelegatingHandler
的SendAsync
方法,而对香草Controller
操作的调用不会触发它.
Search and Research个
我研究了Web Api,了解到它包括DelegatingHandler
类的父类HttpMessageHandler
.这让我相信HTTP消息处理程序通常只作为Web API管道的一部分执行.
而且,Http Message Handlers run before Url Routing,所以可能不是URL路由在Web API和MVC管道之间做出 Select .
...考虑使用Acter过滤器代替消息处理程序[因为A]
Question
-
HttpMessageHandlers
是ASP.NET Web API的一部分,而不是ASP.NET MVC的一部分吗? - MVC中的
HttpMessageHandler
等效值是多少(图中为EQUIVALENT)? - 是什么导致请求遵循Web API管道(图中为FORK)?
- Web API请求与MVC请求有根本不同吗?
我的感觉是大概是这样的,不过请纠正我.
Request from Client
|
IIS
|
ASP.NET
|
HttpApplication.BeginRequest
|
et cetera
|
HttpApplication.MapRequestHandler - is this what does the routing?
|
FORK
/ \
/ \
/ \
/ \
/ \
**Web API** **MVC**
| |
HttpControllerRouteHandler MvcRouteHandler
| |
HttpControllerHandler |
| |
HttpMessageHandlers EQUIVALENT?
i.e. |
DelegatingHandlers |
incl. |
HttpServer |
CustomHandlers |
HttpRoutingDispatcher |
HttpControllerDispatcher |
Helpful Links个