Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Web Services with Windows Azure (new)

You're reading from   Building Web Services with Windows Azure (new) Quickly develop scalable, REST-based applications or services and learn how to manage them using Microsoft Azure

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781784398378
Length 322 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface Introduction FREE CHAPTER 1. Getting Started with the ASP.NET Web API 2. Extending the ASP.NET Web API 3. API Management 4. Developing a Web API for Mobile Apps 5. Connecting Applications with Microsoft Azure Service Bus 6. Creating Hybrid Services 7. Data Services in the Cloud – an Overview of ADO.NET and Entity Framework 8. Data Services in the Cloud – Microsoft Azure Storage 9. Data Services in the Cloud – NoSQL in Microsoft Azure Index

HTTP 2.0

HTTP 2.0 is the next planned version of the HTTP protocol specification and is an attempt to optimize the usage of network resources and reduce latency through header compressions and pooling multiple connections over the same channels. The initiative is spearheaded by Google and Mozilla research teams and as of today, is in a working draft state. The good news is that HTTP 2.0 is going to retain all the goodness of HTTP 1.1 while making it more performant over the wire through efficient processing of messages. Since HTTP 2.0 is still in the making, we will refrain from using it for the scope of this book. However, if you are enthusiastic to know more about HTTP 2.0, you can take a look at the current draft of the specification at http://http2.github.io/http2-spec/.

For the scope of this book, HTTP always refers to HTTP 1.1 specification of the protocol.

HTTP and .NET

Starting from .NET 4.5, a new namespace and assembly was added as part of the framework, System.Net.Http. The resemblance of the types in this namespace may look behaviorally similar to those defined in ASP.NET System.Web.Http namespace; however, the addition of this namespace marks a big difference in the development of HTTP services.

Firstly, it enables unified communication over HTTP by providing a set of abstract types. These types allow any .NET application to access HTTP services in a consistent way, for example, now both the client and server can use the same HTTP programming model for better development experience. Secondly, it has been written to target modern HTTP apps such as Web API and mobile development, this signifies the investment of Microsoft in making HTTP services a first-class citizen.

Some of the key types defined in this namespace are:

Type

Description

HttpClient

This enables primitive operations for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.

HttpRequestMessage

This represents the HTTP request message from a client.

HttpResponseMessage

This represents the HTTP response message received from an HTTP request.

HttpContent

This is a base class that represents an HTTP entity body and any content headers.

HttpMessageHandler

This is the base type for all message handlers and this will be used to define all message handlers. Message handlers may be used to create server-side or client-side handlers.

The server-side handler works with the hosted model chain and handles incoming client requests (HttpServer and HttpSelfHostServer). It determines the correct route for the request (HttpRoutingDispatcher) and dispatches the request to the controller (HttpControllerDispatcher).

The HttpClient type uses client-side message handlers to process requests. The default handler HttpClientHandler is responsible to send the request and get the response from the server.

We may, of course, hook our custom controllers in the pipelines, for example, to validate, modify, or log the requests.

Note

For a complete list of all types available in the System.Net.Http namespace, please visit http://msdn.microsoft.com/en-us/library/system.net.http(v=vs.110).aspx.

We will see in the later sections that the ASP.NET Web API also leverages some of the System.Net.Http types for communication over HTTP.

You have been reading a chapter from
Building Web Services with Windows Azure (new)
Published in: May 2015
Publisher:
ISBN-13: 9781784398378
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime