Click here to Skip to main content
15,881,281 members
Articles / Web Development / ASP.NET

Top New Features in ASP.NET Web API 2.1

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
7 Jun 2014CPOL3 min read 10.6K   2  
We are going to discuss about the top features in ASP.NET Web API 2.1.

In this ASP.NET Web API tutorial, we are going to discuss about the top features in ASP.NET Web API 2.1. We have already discussed about the Top 5 features in ASP.NET Web API 2.0 in a separate post on this Web Development blog.

ASP.NET Web API is a framework for building HTTP services for broader range of clients, i.e., browsers as well as mobile devices, on top of .NET Framework. Using ASP.NET Web API, we can create non-SOAP based services like plain XML or JSON strings, etc. with many other added advantages including:

  • Create resource-oriented services using the full features of HTTP.
  • Exposing services to a variety of clients easily like browsers or mobile devices, etc.

Note: You can download a PDF version of “A Practical Guide to ASP.NET Web API” here or read Online Version here.


Following are the new exciting features in ASP.NET Web API 2.1 straight from Microsoft ASP.NET Web API Team:

  • Global error handling
  • Attribute routing improvements
  • Help Page improvements
  • IgnoreRoute support
  • BSON media-type formatter
  • Better support for async filters
  • Query parsing for the client formatting library
  • Various bug fixes

Attribute Routing Improvements:

ASP.NET Web API first provided support for Attribute Routing along with convention-based routing in version 2.0. We discussed in detail about Attribute Routing in a separate post “Attribute Routing ASP.NET Web API 2.0“. With attribute routing, support for certain URI pattern was provided like nested routing on same controller.
In version 2.1, using IDirectRouteFactory interface and RouteFactoryAttribute class, attribute routes are customizable now.
ASP.NET Web API Team further enhanced Attribute routing feature as it now supports:

  • Constraints
  • Enabled versioning
  • Header-based Route selection

Global Error Handling

As ASP.NET Web API generates response for a variety of clients (browsers and mobile devices etc.), so a central mechanism is needed for handling all unhandled exceptions in a more organized and robust way. ASP.NET Web API now support for Global Error Handling which is basically a more controlled way of handling all unhandled exceptions. It’s now equipped with multiple exception loggers looking for unhandled exception and related information. It also facilitates for generating a fully customizable HTTP response message in case an unhandled exception occurs.

Web API Help Page Improvements

Web API Help Page is a good way to facilitate other developers how they can consume our ASP.NET Web API
service. A library was already available to auto-generate help pages at run time. But in Web API 2.1, further enhancements were provided to Web API Help Pages including:

  • documenting properties of an action’s parameter or return types
  • documenting data model annotations

Hopefully, the above post will be helpful and we will keep exploring new and exciting features of ASP.NET Web API.

Other Related Articles

The post Top New Features in ASP.NET Web API 2.1 appeared first on Web Development Tutorial.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Emaratech
United Arab Emirates United Arab Emirates
Imran Abdul Ghani has more than 10 years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET(MCSD.NET) since 2005. You can reach his blogging at WCF Tutorials, Web Development, SharePoint for Dummies.

Comments and Discussions

 
-- There are no messages in this forum --