Home >Backend Development >C#.Net Tutorial >What are the built-in message handlers in Asp.Net webAPI C#?
The message handler is a class that receives HTTP requests and returns HTTP reply. Message handlers are derived from the abstract HttpMessageHandler class. Message handlers provide us with the opportunity to process, edit or reject incoming messages Before the request reaches the HttpControllerDispatcher.
Message handlers are executed earlier in the request processing pipeline, so They are a great place to implement cross-cutting concerns in a Web API. information A handler is nothing more than a series of classes (it may be system-defined or represented by us) sits alongside the process of piping HTTP requests and responses.
For example, an HTTP request arrives at an HTTP server, now the request will be Passed to HandlerA, after processing in HandlerA, it may go to HandlerB, soon. Now, the advantage here is that we can do this in each The processing procedure depends on our business needs.
In ASP.NET Web API Framework, there are two types of message handlers: usable. They are as follows.
On the server side , the Web API pipeline uses some built-in message handlers -
We can add custom handlers to the pipeline. Message handlers are great for crosscutting Issues operating at HTTP message level (rather than controller level) action). For example, a message handler might -
On the client side, the HttpClient class uses a message handler to handle requests. The default handler is HttpClientHandler, which sends the request over the network and get the response from the server. We can insert custom message handlers into the client pipeline.
The above is the detailed content of What are the built-in message handlers in Asp.Net webAPI C#?. For more information, please follow other related articles on the PHP Chinese website!