Notes from the ASP.NET Web API live meeting

Topics: Web Api
Feb 8, 2012 at 6:26 PM
Edited Feb 8, 2012 at 6:33 PM

Thanks for an excellent presentation Daniel, much appreciated to finally get some details.

We'll hopefully get an official blog soon, but here are a few notes I took when watching the live meeting today :)
The session was recorded and will be available in a few days.


* Official name is now: ASP.NET Web API
* MVC 4 beta coming late February, including Web API and go live license.
* RTM in Q3 2012 :(
* Will support ASP.NET 4.0, including a HttpClient implementation
* ASP.NET Web API is not limited to only MVC4, possible to host in WebForms for example.
* ASP.NET Web API is a separate assembly with no dependency on system.web.mvc.dll
* Deep integration with MVC routing to identify resources, including default values and constraints
* Web API uses MapHttpRoute() with a routeTemplate ("api/{controller}/{id}"), very similar to the MVC .MapRoute.
  - UriTemplates not attributes on methods anymore.
  - Discovers actions based on method name (Get, Post etc), but possible to override with attributes.
* HttpOperationHandler replaced by MVC ActionFilters.
* Authorization filter attributes, just like MVC
   - Uses thread principal (demo used forms based and returned a 401 if not authenticated)
* Exception filters
* All stack is async Task based.
* Web API classes inherit from ApiController base class
   - Instantiated per request, stateless
* HTTP methods are now like MVC actions
* Fancy new starting page :)
  - Demo had this interesting URL (not working atm): http://asp.net/web-api
* HttpResponseException and HttpResponseMessage/Request still there :)
* MVC-like model binding to input parameters
* Model binding validation using filters and data annotations!
  - The showed a demo using client-side binding errors, and he mentioned it used content negotiation ?
* Message body bound to types using MediaTypeFormatters
  - He also mentioned input params using model binders, response uses formatters?
* Content negotiation supported based on Accept header
* No static context objects :) <-- But MVC controller classes had a mockable HttpContext?
* HttpRequestMessage.Properties is still the way to keep request context
* DependencyResolver to connect IOC.. Not familiar with what this is?
* They are working on helpers for generating links to resources, from the routing engine I guess? Like MVCs ActionLink?
* OData supported simply by returning IQueryable<T> from actions, the rest is automatic.
* Web API/MVC ships with dynamic JsonObject types
* Supports hosting in IIS or self-hosting.
  - HttpConfiguration is still there
  - HttpSelfHostServer class
* Only a tiny bit of WCF left in there, I think he said its used for message dispatching in self hosting?
* Plan on supporting MVC output caching, not supported in beta though.
* HTTP test client not in beta, but planned for release.
* They are considering supporting JSON.NET out of the box.

 

I must say I couldn't be happier, this is all VERY promising and we'll be getting an even more mature framework than we have in the preview bits.

Feb 8, 2012 at 6:29 PM

Eh. I dislike most of these ideas. Lame.

Never had a single good experience with MVC filters.

Feb 8, 2012 at 8:39 PM

Thanks for posting notes, SiggiG.  I was unable to watch the demo live and hope to catch it when it's released.  I think that list is mostly good but it's gonna be one big re-write when we get the new bits.  I do hope they support Json.NET out of the box.  It is clearly a superior implementation.  I'm interested to see how they handled authentication.  I just spent the weekend figuring out how to multi-host in a single webrole in Azure because I did not like the Redirect Hijack HttpModule workaround discussed in several other threads on this board.

Feb 9, 2012 at 7:28 AM

Siggi - many thanks for that write up!  All of those points sound excellent to me; we have very good experiences with MVC.  This will facilitate our website MVC guys coming and helping me on our REST Service / Web API... they will feel right at home.

I have some work to do if operation handlers are going, but it shouldn't be a big deal.

Like David I also really like JSON.NET and use it for all JSON work (I have a tiny issue with it, which is easily worked around).

RTM in Q3 sounds about right TBH, considering the amount of work there is to be done.

Feb 12, 2012 at 2:50 PM

Wasn't one of the original goals to allow Web API apps to be built on an HTTP stack that didn't depend on ASP.NET on IIS? Is that design requirement being abandoned now?

Feb 12, 2012 at 5:21 PM

You can still host it outside IIS.

Feb 12, 2012 at 5:51 PM

Yes, “selfhost” as it is called is fully supported.

Henrik

From: SiggiG [email removed]
Sent: Sunday, February 12, 2012 10:22 AM
To: Henrik Frystyk Nielsen
Subject: Re: Notes from the ASP.NET Web API live meeting [wcf:299170]

From: SiggiG

You can still host it outside IIS.

Feb 14, 2012 at 4:02 PM
SiggiG wrote:

Thanks for an excellent presentation Daniel, much appreciated to finally get some details.

We'll hopefully get an official blog soon, but here are a few notes I took when watching the live meeting today :)
The session was recorded and will be available in a few days.


Anyone know if the presentation has been posted yet?  I've been checking http://www.c4mvc.net/meeting/?id=25 daily and have not seen any changes.  Dan, can you comment?

Thanks.

Coordinator
Feb 14, 2012 at 4:13 PM

The session is already there – the link you posted works for me:

Daniel Roth