ASP.NET Web API – A New Way to Handle REST
Web API is the first real alternative to WCF that .NET developers have seen in the last six years. Until now emerging trends such as JSON were merely exposed as WCF extensions. With Web API, developers can leave the WCF abstraction and start working with the underlying HTTP stack.
Web API is built on top of the ASP.NET stack and shares many of the features found in ASP.NET MVC. For example, it fully supports MVC-style Routes and Filters. Filters are especially useful for authorization and exception handling.
In order to reduce the amount of mapping code needed, Web API supports the same Model binding and validation used by MVC (and soon to be released NET Web Forms 4.5). The flip side of this is the content negotiation features. Web API automatically supports XML and JSON, but the developer can add their own formats as well. The client determines which format(s) it can accept and includes them in the request header.
Making your API queryable is surprisingly easy. Merely have the service method return IQueryable<T> (e.g. from an ORM) and it Web API will automatically enable OData query conventions.
ASP.NET Web API can be self-hosted or run inside IIS.
first real alternative
Re: first real alternative
Then there is the strange decision to reinvent stuff that is unrelated to the core functionality of OpenRasta. This shouldn’t be shipping with its own IoC container, it shouldn’t even need one. That is something that the developers should decide for themselves. And then there aforementioned logging API, which completely ignores .NET’s official API (TraceListener) as well as the popular alternatives. Heck, it even has its own package manager that simply wraps NuGet.
The whole love/hate relationship with ASP.NET is very confusing, but not as confusing as their project pages. When I go to get the bits from their home page they aren’t even sure if I’m supposed to be using OpenWrap or NuGet. And the only link they provide is to their “stable” repository, which really contains the obsolete branch. (Which in a way means that it is stable.)
I like writing about open source alternative’s to Microsoft’s .NET libraries. We need that competition to better the platform as a whole. But I can’t recommend something in this state. They need a lot of help to clear out the cruft and focus on the core feature set.
Re: first real alternative
www.servicestack.net has been Open Source and shipping on Production systems for over 4 years has amassed over 47 contributors and is the 11th most watched C# project on GitHub and yet it fails to meet your definition as an alternative?
What about it shipping the fastest text serializers for .NET? Like the kind StackOverflow had to switch to in order to get decent JSON performance:
StackOverflow Careers also uses ServiceStack for all its Back Office web services, which makes use of all ServiceStack's components: JSON Serializer, C# Redis Client, OrmLite database since they are all lean libraries that work with clean POCOs and provide great performance:
Here's an answer on StackOverflow that compares ServiceStack vs WebApi - I recommend getting familiar with the alternatives that *DO* exist before claiming otherwise in all sincerity.
Anatole Tresch Mar 03, 2015