Asp. Net Web API (1), asp. netwebapi

Source: Internet
Author: User

Asp. Net Web API (1), asp. netwebapi
What is Web API

HTTP is not only used for Web Pages. It is also a powerful platform for creating APIs that display services and data.HTTP is simple, flexible, and ubiquitous. You can imagine that almost any platform has an HTTP service library.HTTP services can involve a wide range of clients, including browsers, various mobile devices and traditional desktop applications.Web API provides a restful API development framework, which provides complete http semantic support.

Differences between Web APIs and MVC 1. Usage differences

MVC is mainly used for Web site development. It implements a complete MVC development framework on the backend to provide convenient page development and backend Html components, users can easily develop websites with pages

Web APIs are mainly used for Open API interfaces, which are more abstract and do not focus on VIew generation.

2. Differences in self-implementation

The two frameworks are mainly modified based on Asp. Net, and are mainly extended to HttpModule and HttpHandler.

MVC builds the second layer on the first layer, and extends a larger routing mechanism to implementMvcHandlerAndControllerFactoryThis message processing and background Controller method selection mechanism. In addition to extending the former, Web APIs also write a set of independent, independent of Asp. net message processing pipeline, just like drawing on the original house model and re-designing another villa, this also explains why Web APIs can be hosted on different hosts (in essence, the host uses a specific application to provide Web APIs to a runtime environment, and solve the request receipt and response), such as the Web Host and Self Host method, which is similar to that of WCF. MVC can only be hosted on IIS (. net core is not considered), just like WebForm. Besides, although both of them have controllers and actions, the request implementation and response mechanisms are also different. For example, the two core classes of Web API processing messages are HttpRequestMessage and HttpResponseMessage. These two frameworks can only be said to be similar in patterns at most, and there is a big difference in implementation.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.