Introduction to the ASP. NET WEB API

Source: Internet
Author: User

The ASP. NET WEB API is a framework for building restful software architectures that is based on the HTTP protocol. HTTP is not only capable of generating our common Web pages, it is also able to build services and resource-oriented platforms. Services built using the HTTP protocol are more lightweight and more concise. Different clients can use the service more seamlessly. To understand why Web APIs are used, one of the first concepts to understand is restful.

Restful

RESTful is a resource-oriented software architecture, and the full text of rest is representational state Transfer, which is the representation level transition. This literal meaning is not easy for us to understand rest, and below, we use a more popular approach to understanding resource-oriented. In our daily use of computing equipment, in fact, the computing device is constantly communicating with another device, such as QQ, and so on, we continuously from a device to obtain data, submit data, update data, delete data. The data here not only refers to numbers and text, but also to pictures, files and so on. This means of communication is called distributed communication. The device exposes a series of operations at one point on the port for use by other devices. These operations are services. We do this by invoking the services exposed by the device and returning the data when necessary. However, the service is implemented regardless of the method used. Client usage services are heavyweight and cumbersome. Because clients want to establish proxies for access to these services and communicate with the service-side devices through proxies. For some relatively lightweight communications, service-oriented obviously increases the complexity of development. REST is a lightweight service-oriented architecture style that is more concise to implement and operate than service-oriented, and can take advantage of the HTTP protocol for responsiveness, performance, efficiency, and ease of use over service-oriented software architectures.

Representational State Transfer (Presentation level transition) can actually be seen as a representation of resource state transitions, and below we use a graph to illustrate several features of rest.

We understand several important components of resource-oriented,

    1. Resource: Resource even if the device entity is distributed on the network (such as text, pictures, songs, files, data ...) )
    2. Presentation layer: A device for displaying resources
    3. URI: The address that points to the network entity resource
    4. State transitions: Display state through the presentation layer with a stateless HTTP protocol

In, a cluster of servers in the network exposes resources externally through address http://127.0.0.1/xxx. The Smart Device a,b,c (can be a PC, which can be an iOS device, can be an Android device) that accesses the address exposed by the server via the HTTP protocol. The server returns the resource back to the client (here is JSON). The client obtains the JSON and assembles the data, and the transition state is presented to the end user. The entire visit is complete. The HTTP action that rest can use is get,post,put,delete. For resource-oriented services, client access is more concise and efficient, and there is no need to set up proxies, and any platform can use the acquired resources directly. Without the need for a specific platform to do special processing. Then, for resource-oriented services, the use of different platforms is more concise. Clients of different platforms only need to focus on the presentation layer, which also adheres to the principle of separation of concerns in the software architecture.

Here's a short explanation of resource-oriented services, in the following sections, let's look at how ASP. NET WEB API implements resource-oriented services

ASP. NET WEB API implements resource-oriented services

Introduction to the ASP. NET WEB API

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.