Use ASP.NET Web API to Build HTTP Services

Nearly all compute devices created these days speak HTTP. This includes computers, game consoles, and mobile devices running on all platforms, including Windows, iOS, Android, and more. These devices use HTTP because users want access to the Internet. In addition, HTTP is open on firewalls across nearly all networks. For this reason, HTTP web services based on REST have emerged as a default standard that is highly accessible on nearly all client devices and increases interoperability across platforms.

The Microsoft ASP.NET Web API eases the development of HTTP services. You can use the skills you learned in Chapter 17, “Building Modern Websites with ASP.NET 5,” regarding web development with MVC (Model-View-Controller) to build service-oriented websites that work with nearly all clients.

The Web API framework takes care of all the plumbing code for you. For example, it includes features such as content negotiation, which allows a client and service to negotiate the right message format, including XML and JSON. Furthermore, ASP.NET Web API services are fully asynchronous and task based. They also have a lightweight hosting model, which gives you a lot of hosting options, including the cloud.


Note

We cover the new ASP.NET 5 Web API in this chapter. You can still use the older version of the ASP.NET application stack to create Web API applications in Visual Studio 2015. In fact, the prior versions work in a similar way, following the MVC pattern. They simply have a different project model and target different framework features (such as not supporting the new .NET Core CLR runtime). Please refer to Chapter 17 for a detailed discussion about the ASP.NET 5 application stack and prior versions.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset