You must add a reference to the System.Web.Http.WebHost assembly and make sure that you have
using System.Web.Http;
Why? MapHttpRoute is defined in two assemblies in System.Web.Http :
public static System.Web.Http.Routing.IHttpRoute MapHttpRoute( this System.Web.Http.HttpRouteCollection routes, string name, string routeTemplate)
Member of System.Web.Http.HttpRouteCollectionExtensions
and in System.Web.Http.WebHost
public static Route MapHttpRoute( this RouteCollection routes, string name, string routeTemplate, object defaults);
The first is an extension to HttpRouteCollection
The second is an extension on RouteCollection
So, when you have the webforms application, your Routes are defined in the RouteCollection , so you need a version of WebHost .
This is because the architecture that allows WebApi to be hosted also from IIS. see WebApi Hosting
Martin kunc
source share