Introduction to ASP.NET Web API

來源:互聯網
上載者:User

標籤:provides   this   oba   rom   over   proc   function   ken   simple   

Services for Native Apps
As stated earlier, smartphones had an important part in the trend toward simpler pure HTTP API and away from
SOAP. Many of the native apps can be likened to dumb terminals connected to a big mainframe, with the mainframe
being the cloud. In these apps, the cloud provides storage and server-side processing and the app is mainly used for
the consumption of the services exposed by an API.
If you are thinking of building an app for smartphones, you should seriously consider exposing your backend
services through a REST API using ASP.NET Web API.
Self-Hosted HTTP Server
Before ASP.NET Web API, there was no easy way to host a simple web server in your Windows service or desktop
application. If you needed to host a service, you had to use WCF, which was not ideal.
ASP.NET Web API has made it extremely easy to host your API in a nonweb server process. Most of the code
you need to write is exactly the same as the code you would write in a web-hosted scenario. You can also use the
self-hosted Web API server to serve static resources or even a server-rendered view (e.g., Razor) so you can serve
web pages. A common scenario is when you have a process running as a Windows service and you need a
web-based administration console for it, in which case the self-hosted Web API is all you need.
ASP.NET Web API and Other Architectural Aspects
In the past few years, the software world has experienced a massive change and a huge influx of ideas and practices
(cloud, devops, BDD, SPA, Big Data, etc.). ASP.NET Web API was born in a landscape of very heterogenous
architectural patterns. There are emerging trends in the community that, whether we like it or not, are going to affect
how we will be using ASP.NET Web API.
This by itself is a big subject, and we are only going to scratch the surface here, but it is important to provide
pointers relevant to the rest of this book!
ASP.NET Web API and ASP.NET MVC
As stated earlier, there is a considerable similarity between ASP.NET Web API and ASP.NET MVC. Having said that,
there is not a great deal of functional overlap between them, but a question that crops up time and time again is the
choice between these two independent frameworks.
If you have tried the ASP.NET Web API template in the Visual Studio, you have probably noticed that this template
combines ASP.NET Web API and ASP.NET MVC. In fact, nothing stops you from using both of these frameworks in the
same project. But you need to be clear about what the main value of each framework is.
ASP.NET MVC is ideal for generating server-side views (Razor or Web Forms). And in terms of processing
client-side data, it is mainly geared toward x-www-form-urlencoded data (form post data). Although ASP.NET Web API
can process x-www-form-urlencoded data and can generate Razor views, it is best for exposing an API.
If you have both these requirements in a project, use both frameworks in conjunction.
ASP.NET Web API and DDD
Since its formalization in 2003, Domain-Driven Design (DDD) has provided the vocabulary, semantics, and conceptual
tools for designing and architecting modern software. Eric Evans introduced DDD in his book Domain-Driven
Design: Tackling Complexity in the Heart of Software (Addison-Wesley 2003), which has earned classic status among
computer software books along with the Gang of Four design patterns book (Design Patterns: Elements of Reusable
Object-Oriented Software, by Erich Gamma et al., Addison-Wesley 1994) and Martin Fowler’s Patterns of Enterprise
Application Architecture (Addison-Wesley 2002).

Introduction to ASP.NET Web API

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.