I created the MVC 4 Web API application inside my solution, but now I have 2 errors and I need help.
'System.Web.Http.HttpConfiguration' does not contain a definition for "MapHttpAttributeRoutes" and the extension method "MapHttpAttributeRoutes" takes the first argument of the type You can find "System.Web.Http.HttpConfiguration" (you do not see using the directive or the link to the assembly?)
This error occurs in the following code
File: WebApiConfig.cs (in the App_Start folder)
using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; using System.Web; public static class WebApiConfig { public static void Register(HttpConfiguration config) {
The other is in Global.asax
'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'
File: Global.asax.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Http.WebHost; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } }

UPDATE
After installing via Nuget WebAPI WebHost (@ sa_ddam213 suggestion), it fixes some problems, but now this error occurs when my application starts
Failed to load file or assembly "System.Net.Http" or one of the dependencies. Installed assembly manifest definition does not map assembly reference
The web.config file has an assembly
<dependentAssembly> <assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0"/> </dependentAssembly>
c # asp.net-web-api asp.net-mvc-4
Lucas_Santos Aug 07 '14 at 11:31 2014-08-07 11:31
source share