Book description

An opportunity for ASP.NET web developers to advance their knowledge with a practical course, designed from the ground up, to help you investigate REST-based services with C# 5. An essential, real-world tutorial.

  • Clear and concise guide to the ASP.NET Web API with plentiful code examples
  • Learn about the advanced concepts of the WCF-windows communication foundation
  • Explore ways to consume Web API services using ASP.NET, ASP.NET MVC, WPF, and Silverlight clients

In Detail

The ASP.NET Web API was designed from the ground up to meet the need of developers who want to build HTTP/RESTful services. ASP.NET Web API is an HTTP service that uses HTTP as the application protocol and can return data based on the data format requested by the client. It is a lightweight web-based architecture that provides an easy-to-use set of default options while providing a deep extensibility infrastructure to meet the demands of any scenario using HTTP.

This book is a step-by-step, practical tutorial with a simple approach to help you build RESTful web applications and Web API services based on the .NET framework quickly and efficiently. This book provides complete coverage of RESTful services and the ASP.NET Web API in a lucid language with plenty of hands-on code examples.

The book starts with a description of REST-based architecture and WCF. It then explores the new features in ASP.NET 4.5 and introduces you to the new concepts in the ASP.NET Web API. There are also plentiful code examples throughout these sections to help you learn effectively.

You will then learn how to work with WCF REST-based services and the ASP.NET Web API and how to consume those services using various clients such as ASP.NET, ASP.NET MVC, WPF, and Silverlight.

In the second half of this book, we discuss the more advanced concepts of the ASP.NET Web API, best practices, and asynchronous programming concepts and how it can be implemented in C# 5.The most important thing you will take home from reading this book is a working knowledge on RESTful services, their architecture, how to build them, and also how to consume them with plenty of tips and techniques to better utilize this technology.

Table of contents

  1. ASP.NET Web API
    1. Table of Contents
    2. ASP.NET Web API
    3. Credits
    4. About the Author
    5. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
        3. Instant Updates on New Packt Books
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Understanding Representational State Transfer Services
      1. Understanding REST
        1. Resources in REST-based architecture
        2. The REST architectural constraints
          1. Client-server
          2. Stateless
          3. Cacheable
          4. Code on demand
          5. Uniform interface
          6. Resource management
        3. SOAP, REST, and XML-RPC – a closer look
        4. Understanding Windows Communication Foundation
        5. REST attributes
          1. WebServiceHost
          2. WebHttpBinding
          3. WebHttpBehavior
          4. WebOperationContext
          5. WebMessageFormat
          6. WebGet
          7. WebInvoke
          8. UriTemplate
        6. REST-based web services
        7. Learning RESTful web services
      2. Implementing RESTful services in .NET 4.5
        1. The UserNamePasswordValidator class
        2. Simplified configuration
        3. Standard endpoints
        4. Discovery
        5. Simplified IIS hosting
        6. Improvements in REST
        7. Implementing a RESTful Service using WCF 4.5
          1. Creating a WCF service
          2. Making the service RESTful
        8. Specifying the binding information
        9. Hosting the RESTful WCF service
          1. Hosting the service inside the console application
        10. Returning JSON data
        11. Consuming the RESTful Service
      3. Summary
    9. 2. Understanding Resource and Service Oriented Architectures
      1. Understanding SOA
        1. Service
        2. Service provider
        3. Service consumer
        4. Service registry
        5. Service contract
        6. Service proxy
        7. Service lease
        8. Message
        9. Service description
        10. Advertising and discovery
        11. From object orientation to SOA to ROA to REST
      2. A look at ROA
        1. Basic properties of ROAs
          1. Basic concepts of ROAs
        2. Fundamental HTTP concepts
      3. Resource Oriented and Service Oriented Architecture
        1. Resource
        2. Uniform resource identifier
        3. Addressability
        4. Statelessness
        5. Representations
      4. Comparison of the three architectural styles
      5. Summary
    10. 3. Working with RESTful Services
      1. Exploring Windows Communication Foundation (WCF)
      2. Applying service behavior
      3. New features in WCF 4.5
        1. Enhancements in the WCF Framework
        2. Simplified configuration
        3. Standard endpoints
        4. Discovery
        5. Simplified IIS hosting
        6. REST improvements
        7. Routing service
        8. The automatic Help page
          1. Bindings in WCF
            1. BasicHttpBinding
            2. WsHttpBinding
            3. netTcpBinding
            4. MsmqIntegrationBinding
            5. netMsmqBinding
            6. netNamedPipeBinding
            7. netPeerTcpBinding
            8. WsDualHttpBinding
            9. WsFederationHttpBinding
            10. Using multiple bindings
          2. Choosing the correct binding
          3. Security in WCF – securing your WCF services
            1. Transport-level security
            2. Message-level security
        9. Implementing RESTful services using WCF
          1. Creating the security database
          2. Creating SecurityService
      4. Making the service RESTful
        1. Hosting Security Service
      5. Summary
    11. 4. Consuming RESTful Services
      1. Understanding AJAX
      2. Introducing JSON and jQuery
      3. Understanding Language Integrated Query (LINQ)
        1. Data source controls
          1. ObjectDataSource
          2. SqlDataSource
          3. SiteMapDataSource
          4. XMLDataSource
          5. LinqDataSource
        2. LINQ to XML
        3. LINQ to SQL
        4. LINQ to Objects
        5. LINQ to Entities
          1. Working with service operations in LINQ
            1. Advantages of LINQ to SQL
      4. Security Service
      5. Consuming Security Service
        1. ASP.NET
          1. Consuming Security Service using ASP.NET 4.5
        2. The ASP.NET MVC Framework
          1. Consuming Security Service using ASP.NET MVC
          2. Asynchronous operations
      6. Understanding Windows Presentation Foundation
        1. Consuming Security Service using WPF
      7. References
      8. Summary
    12. 5. Working with ASP.NET 4.5
      1. Working with the OData protocol
        1. Working with the ASP.NET Web API and OData
      2. New features in the .NET Framework 4.x
        1. Supporting asynchronous programming in .NET Framework 4.x
      3. Introducing the new features in ASP.NET 4.5
        1. Enhanced state management features
        2. Performance monitoring
        3. Extensible Output Caching
        4. Search Engine Optimization (SEO)
        5. Other notable enhancements
      4. Working with the ASP.NET Web API
        1. The ASP.NET Web API architecture
        2. Routing in the ASP.NET Web API
        3. Implementing the ASP.NET Web API for the Security database
      5. Summary
    13. 6. Working with RESTful Data Using Silverlight
      1. Introducing Silverlight 5
        1. New features in Silverlight 5
      2. WCF 4.5 RIA Services
      3. Implementing a sample application
        1. CRUD operations
      4. Summary
    14. 7. Advanced Features
      1. Best practices in using WCF
        1. WCF security issues
          1. Bindings
        2. WCF security
          1. Message-level security
            1. Using the FaultContract attribute
          2. Transport-level security
            1. Implementing transport-level security
      2. Best practices in using WCF services
      3. Best practices in using the ASP.NET Web API
      4. References
      5. Summary
    15. A. Library References
      1. Section A
        1. Popular REST-based service frameworks
        2. Ruby on Rails
        3. Restlet
        4. Django REST
        5. The Flickr REST API
        6. The Google API
        7. Yahoo! Social REST APIs
      2. Section B
      3. Working with the Visual Studio 2013 IDE
        1. Installing Visual Studio 2013
        2. New features in the Visual Studio 2013 IDE
        3. HTTP requests and response code
        4. Abbreviations
        5. The ASP.NET Web API library reference (based on .NET Framework Version 4.5)
      4. References
    16. Index

Product information

  • Title: ASP.NET Web API
  • Author(s):
  • Release date: December 2013
  • Publisher(s): Packt Publishing
  • ISBN: 9781849689748