Skip to Main Content
Designing Evolvable Web APIs with ASP.NET
book

Designing Evolvable Web APIs with ASP.NET

by Glenn Block, Pablo Cibraro, Pedro Felix, Howard Dierking, Darrel Miller
March 2014
Intermediate to advanced content levelIntermediate to advanced
538 pages
13h 19m
English
O'Reilly Media, Inc.
Content preview from Designing Evolvable Web APIs with ASP.NET

Chapter 11. Hosting

Web API meets its downstairs neighbors.

Chapter 4 divided the ASP.NET Web API processing architecture into three layers: hosting, message handler pipeline, and controller handling. This chapter addresses in greater detail the first of these layers.

The hosting layer is really a host adaptation layer, establishing the bridge between the Web API processing architecture and one of the supported external hosting infrastructures. In fact, Web API does not come with its own hosting mechanism. Instead, it aims to be host independent and usable in multiple hosting scenarios.

In summary, the host adapter layer is responsible for the following tasks:

  • Creating and initializing the message handler pipeline, encapsulated in an HttpServer instance.
  • Receiving HTTP requests from the underlying hosting infrastructure, typically by registering a callback function.
  • Transforming HTTP requests from their native representation (e.g., ASP.NET’s HttpRequest) into HttpRequestMessage instances.
  • Pushing these instances into the message handler pipeline, effectively initiating the Web API request processing.
  • When a response is produced and returned, the hosting adapter transforms the returned HttpResponseMessage instance into a response representation native to the underlying infrastructure (e.g., ASP.NET’s HttpResponse) and delivers it to the underlying hosting infrastructure.

In version 1.0, two hosting adapters were available: web hosting and self-hosting. The former hosting option ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ASP.NET Web API

Mastering ASP.NET Web API

Mithun Pattankar, Malendra Hurbuns
Enterprise Application Development with C# 9 and .NET 5

Enterprise Application Development with C# 9 and .NET 5

Ravindra Akella, Rishabh Verma, Arun Kumar Tamirisa, Suneel Kumar Kunani, Bhupesh Guptha Muthiyalu

Publisher Resources

ISBN: 9781449337919Errata Page