You are previewing Pro ASP.NET Web API: HTTP Web Services in ASP.NET.
O'Reilly logo
Pro ASP.NET Web API: HTTP Web Services in ASP.NET

Book Description

Pro ASP.NET Web API shows you how to build flexible, extensible web services that run seamlessly on a range of operating systems and devices, from desktops to tablets to smart phones—even the ones we don't know today.

ASP.NET Web API is a new framework designed to simplify web service architecture. So if you're tired of interoperability issues between inflexible web services and clients tied to specific platforms or programming languages, or if you've ever struggled with WCF, this book is for you.

To start with, you'll get up to speed on Web API's modern HTTP programming model, REST and your hosting options. You'll then dive into building a real application over a series of three chapters, so you can get an immediate feel for how this technology works in practice. The second half of the book features dedicated chapters on topics like routing, controllers, validation and tracing, and the authors close with discussions on performance, hosting and an all-important look at unit testing to help you prepare your application for the real world.

ASP.NET Web API makes HTTP a first-class citizen of .NET. With Pro ASP.NET Web API, you can build HTTP-based web services for your company or business, expose your data to the world across different formats and devices and gain the best possible global reach for your application.

What you'll learn

  • The basics of HTTP web services

  • How to build HTTP-based web services on the .NET platform

  • In-depth knowledge of ASP.NET Web API and its processing architecture

  • How to Unit Test an ASP.NET Web API application

  • Asynchronous programming with ASP.NET Web API

  • Consuming HTTP-based web services across several different clients

Who this book is for

Whether you've previously worked with WCF or are an ASP.NET developer diving into web services for the first time, Pro ASP.NET Web API will show you a clean, modern approach to building HTTP web services.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
  9. CHAPTER 1: Introduction to ASP.NET Web API
    1. ASP.NET Web API
    2. ASP.NET Web API Background
    3. ASP.NET Web API Architecture
    4. ASP.NET Web API in Modern Architecture
    5. ASP.NET Web API and Other Architectural Aspects
    6. ASP.NET Web API and API Governance
    7. Summary
  10. CHAPTER 2: Introduction to Asynchronous Programming in .NET
    1. What Is It All About?
    2. IIS Web Server and Asynchronous Processing
    3. Where to Favor Asynchronous Programming
    4. Old Asynchronous Programming Models in .NET
    5. Task-Based Asynchronous Pattern (TAP)
    6. C# 5.0 Asynchronous Language Features
    7. Summary
  11. CHAPTER 3: HTTP, REST, and Hypermedia
    1. HTTP Basics
    2. REST
    3. Summary
  12. CHAPTER 4: HttpClient
    1. Commonalities: HTTP in ASP.NET Web API and HttpClient
    2. HttpClient
    3. Summary
  13. CHAPTER 5: Sample Application: Application Structure and Domain Model
    1. PingYourPackage: An Overview
    2. Project Structure and Architecture
    3. Building the Domain Model
    4. Summary
  14. CHAPTER 6: Sample Application: Building the Web API
    1. Infrastructure of Our Web API Application
    2. Implementing the Security
    3. Implementing Controllers
    4. Summary
  15. CHAPTER 7: Sample Application: Building the Wrapper and Web Client
    1. Building a .NET Wrapper for the HTTP API
    2. Building a Web Client with ASP.NET MVC
    3. Summary
  16. CHAPTER 8: Routing
    1. Understanding Routing Mechanism
    2. Defining Web API Routes
    3. Summary
  17. CHAPTER 9: Controllers and Actions
    1. Overview
    2. Creating a Controller
    3. Controller Actions
    4. Per-Controller-Type Configuration
    5. Summary
  18. CHAPTER 10: Message Handlers
    1. Overview and Message Handler Mechanism
    2. Custom Message Handlers
    3. Registering Custom Message Handlers
    4. Per-Route Message Handlers
    5. Summary
  19. CHAPTER 11: Filters
    1. Overview and Filter Processing Model
    2. Registering Filters
    3. Types of Filters
    4. Summary
  20. CHAPTER 12: Media Type Formatters and Model Binding
    1. Overview
    2. Formatter Processing Model
    3. Default Formatters
    4. Custom Formatters
    5. Formatter Configuration
    6. Media Type Mappings
    7. Model Binding
    8. Summary
  21. CHAPTER 13: Input Validation
    1. Overview
    2. Data Annotation Validation Attributes
    3. Custom Validation
    4. Summary
  22. CHAPTER 14: Dependency Resolution
    1. Key Inversion of Control Concepts
    2. Service Location in ASP.NET Web API
    3. Dependency Resolution Model in ASP.NET Web API
    4. Using DependencyResolver Implementations Available for ASP.NET Web API
    5. Implementing DependencyResolver Model in DI Frameworks
    6. Summary
  23. CHAPTER 15: Unit Testing and Integration Testing
    1. Unit Testing in ASP.NET Web API
    2. Integration Testing
    3. Summary
  24. CHAPTER 16: Optimization and Performance
    1. ASP.NET Web API Asynchronous Actions
    2. HTTP Caching
    3. Summary
  25. CHAPTER 17: Hosting
    1. Hypertext Transfer Protocol Stack
    2. ASP.NET Web API Hosting Model
    3. Web Hosting
    4. Self-Hosting
    5. OWIN
    6. Summary
  26. CHAPTER 18: Tracing, Logging, and API Documentation
    1. Tracing and Logging
    2. Documenting Your Web API
    3. Summary
  27. Index