In ASP.NET Web API, HTTP requests and responses are processed in a pipeline on the server.
If I want to add some logic or global behaviour at the very early stages of the pipeline , I should do it in the Message Handler. ( for example : authentication)
But what about the Http module pipeline ? where it fits in this whole story ?
Looking at this numbered stages of web api life cycle :
https://i.stack.imgur.com/jkQe8.jpg
But looking at the Http module general events ( contains more but...)
Question :
— How those 2 systems combine and where ? I mean if there was 1 picture which contains web api and http module , how would the numbers be ? (I added numbers in the images for easy referencing)
— I always hear that If i want to do things earlier at the pipeline I should use message handlers , but what about HttpModule's BeginRequest
for example ? I know that there are objects which are null at this stage but still , later phases at the httpmodule does inflate HttpContetxt's objects - and yet , webapi's guys says : use MessageHandlers....(is it relate to the fact of selfhoster environment) ?