WebAPI + EPi + .NET 4.5 not working

Member since: 2010

Hi, everyone,

I've followed the example here:

http://www.frederikvig.com/2012/02/using-the-asp-net-web-api-framework-with-episerver/

 

However, I've stumbled upon the first step: registering a route. This is the error I get on:

 System.Net.Http.HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

in

routes.MapHttpRoute(
                       name: "ActionApi",
                       routeTemplate: "api/{controller}/{action}/{id}",
                       defaults: new { id = RouteParameter.Optional }
                    );

    

Anyone had the same problem? And a solution?

 

 

#73113 Jul 05, 2013 17:14
  • Member since: 2009

    The problem might be that System.Net.Http is already included in 4.5. The reference in your project probably points to the one in the webapi package, which is needed for 4.0? If so, just remove that reference and add one to the one included in the framework. Hopefully that will solve your problem.

    #73122 Jul 07, 2013 9:27
  • Version 2.0.0.0 is also an old version, afaik you should use version 4.0.0.0.

    Frederik

    #73124 Jul 08, 2013 8:43