Professional Documents
Culture Documents
ASP Net Web API Poster
ASP Net Web API Poster
Self-Hosting
HttpControllerHandler
HttpSelfHostServer
HttpServer
Create Controller
Create an API controller based on the request.
1. Select controller type
HttpControllerDispatcher
SelectController
HttpControllerDescriptor
IHttpControllerSelector
GetControllerTypes
ICollection<Type>
IHttpControllerTypeResolver
HttpRequestMessage
HttpResponseMessage
GetAssemblies
ICollection<Assembly>
IAssembliesResolver
DelegatingHandler
Yes
HttpControllerDispatcher
Create
Per-route
Message Handlers
HttpRoutingDispatcher
Route.Handler
is null?
2. Activate controller
IHttpControllerActivator
Route.Handler
No
IHttpController
DelegatingHandler
HttpControllerDispatcher
HttpMessageHandler
Create API
controller
ApiController
SelectAction
HttpActionDescriptor
IHttpActionSelector
Controller
Select controller
action
E
Error response
Authorization
Filters
Exception
Filters
Model Binding
Result Conversion
ApiController
InvokeActionAsync
Task<HttpResponseMessage>
IHttpActionInvoker
Action filters are invoked
twice, before and after the
controller action.
Action Filters
OnActionExecuting
Key
OnActionExecuted
Exception!
Built-in Class
Extensibility Point
Invoke Action
Note
Request
Controller Action
Response
HttpRequestMessage
Model Binding
Result Conversion
Request message
URI
HttpResponseMessage
Headers
Entity-body
FormatterParameterBinding
ModelBinderParameterBinding
HttpParameterBinding
IContentNegotiator
A media-type formatter
reads the message body
(if any).
A custom parameter
binding can read any part
of the HTTP request.
If return type is
HttpResponseMessage,
pass through.
Complex Type
IModelBinder
IValueProvider
Simple Type
Action parameters
Any Type
HttpResponseMessage
If return type is
void, create
response with
status 204 (No
Content).
void
Other types
Email: MSPoster@microsoft.com
2012 Microsoft Corporation. All rights reserved.