GlobalConfiguration.Configure() not present after Web API 2 and .NET 4.5.1 migration


I recently started following this guide to migrate my project to .NET 4.5.1 and Web Api 2.

The very first thing MS developer Rick Anderson asks you to do is change:




in the global.asax file. Yet this is giving me an error when I try to build:

Error 1 'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'

My project is currently on MVC 5 and Web Api 2 and .NET 4.5.1, yet I think System.Web.Http still thinks it's the .NEt 4.0 version.

How can I go about fixing this?

Thank you.


Here are my assembly bindings:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="" newVersion=""/>
  </dependentAssembly> -->

Everything commented out after the top was commented because I was getting the error:

Warning 2 Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

and getting rid of the hard bindings was fixing that.

This question is tagged with c#

~ Asked on 2013-11-26 19:57:07

The Best Answer is


It needs the system.web.http.webhost which is part of this package. I fixed this by installing the following package:

PM> Install-Package Microsoft.AspNet.WebApi.WebHost 

or search for it in nuget

~ Answered on 2014-02-02 18:53:54


None of these ideas helped my project using MVC 5.2.2.

  • System.web.Http 5.2.2 was already installed
  • Deleting the Packages folder and completely re-downloading all NuGet libraries did nothing
  • Web.config already had a dependentAssembly entry for System.Web.Http

Forcing a reinstall corrected the problem. From the NuGet package manager console:

update-Package -reinstall Microsoft.AspNet.WebApi.WebHost

~ Answered on 2014-09-23 18:38:45

Most Viewed Questions: