ASP.NET Web API 2.1 RC is out – what’s new?

· 467 words · 3 minutes to read

It seems that only yesterday we were blogging about new features in Web API 2 and discussing what’s coming up next for Web API at the MVP Summit.

Meanwhile, the ASP.NET team kept it’s frantic work pace and already before Christmas dropped on Nuget a 2.1 RC of Web API (as well as new MVC and Web Pages).

While in the open source mode of operation (public commits, nightly builds) this is that big of a news, it is still a very nice piece of news. Let’s look at what’s new.

Overview of ASP.NET Web API 2.1 RC 🔗

The official release notes are available here. Most of the features you have already seen - as on this blog we try to cover both existing and the upcoming bits of the Web API framework.

You can grab the release from Nuget:

Install-Package Microsoft.AspNet.WebApi -Pre  

Glboal error handling 🔗

Arguably the biggest feature of this drop - something that has been very heavily discussed i nthe advisors meetings and in the discussion list.

The full feature specification is available here.

Now, in short, you get a single point of error handling for your Web API - something that didn’t exist before, and trying to handle all errors required you to catch in many places (or resort to Global.asax).

Up to this point you could use ExceptionFilters for more or less widely-scoped error handling; but they wouldn’t catch exceptions from message handlers, media type formatters or routing.

The simplest example is absolutely trivial:

public class TraceExceptionLogger : ExceptionLogger  
public override void LogCore(ExceptionLoggerContext context)  

BSON formatter 🔗

Web API now supports application/bson out of the box. We have written a BSON formatter on this blog back in the summer of 2012 and it’s also a part of WebApiContrib, but it’s nice to have it in the core, especially as it doesn’t bring in any external dependencies (it relies on JSON.NET).

It has also been hardedned a bit, so that’s another plus.

Async filters 🔗

I have just recently blogged about async filters for Web API. As mentioned there, the vNext will have it in the box, and as a result, you can enjoy this feature in Web API 2.1 RC.

Ignore routes 🔗

HttpRoutesCollection will now support IgnoreRoute mechanism, allowing you to easily exclude parts of your routing hierarchy from being matched.

Attribute routing enhancements 🔗

Attribute routing now provides new extensibility hooks. They are described in detail here (bottom of the page) and allow you to provide instructions on custom route resolution (IDirectRouteProvider). This is extremely useful when trying to do something like versioning or localization.

Fixes, fixes, fixes 🔗

Plenty of bug fixes too. Among the more interesting ones:


Hi! I'm Filip W., a cloud architect from Zürich 🇨🇭. I like Toronto Maple Leafs 🇨🇦, Rancid and quantum computing. Oh, and I love the Lowlands 🏴󠁧󠁢󠁳󠁣󠁴󠁿.

You can find me on Github and on Mastodon.

My Introduction to Quantum Computing with Q# and QDK book
Microsoft MVP