title: Could not load file or assembly 'System.Web.Http 4.0.0 after update from 2012 to 2013
body: <p>I did the upgrade according to. 
  <a href="http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2">http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2</a></p>
  
  <p>I get the error. Does any one else got this error?</p>
  
  <blockquote>
    <h2>Server Error in '/' Application.</h2>
    
    <p>Could not load file or assembly 'System.Web.Http, Version=4.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
    dependencies. The located assembly's manifest definition does not
    match the assembly reference. (Exception from HRESULT: 0x80131040)<br>
    Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.IO.FileLoadException: Could not load file
    or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
    located assembly's manifest definition does not match the assembly
    reference. (Exception from HRESULT: 0x80131040)</p>
    
    <p>Source Error: </p>
    
    <p>Line 48:              Line 49:              Line 50:         } Line
    51:  Line 52:         protected void Application_BeginRequest(object
    sender, EventArgs e)</p>
    
    <p>Source File: 
    d:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\Global.asax.cs    Line: 
    50 </p>
    
    <p>Assembly Load Trace: The following information can be helpful to
    determine why the assembly 'System.Web.Http, Version=4.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.</p>
    
    <p>=== Pre-bind state information === LOG: DisplayName = System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
    (Fully-specified) LOG: Appbase =
    file:///D:/SM/7.4Test/WebAPIServerV2/ThirdPartyWebAPI/ LOG: Initial
    PrivatePath = D:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\bin
    Calling assembly : ThirdPartyWebAPI, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=null.
    === LOG: This bind starts in default load context. LOG: Using application configuration file:
    D:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\web.config LOG: Using
    host configuration file:
    C:\Users\michalc\Documents\IISExpress\config\aspnet.config LOG: Using
    machine configuration file from
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Post-policy reference: System.Web.Http, Version=4.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting
    download of new URL
    file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
    ASP.NET Files/root/9184b2ea/c6d4b139/System.Web.Http.DLL. LOG:
    Attempting download of new URL
    file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
    ASP.NET
    Files/root/9184b2ea/c6d4b139/System.Web.Http/System.Web.Http.DLL. LOG:
    Attempting download of new URL
    file:///D:/SM/7.4Test/WebAPIServerV2/ThirdPartyWebAPI/bin/System.Web.Http.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Major
    Version ERR: Failed to complete setup of assembly (hr = 0x80131040).
    Probing terminated.</p>
    
    <p>Stack Trace: </p>
    
    <p>[FileLoadException: Could not load file or assembly 'System.Web.Http,
    Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
    one of its dependencies. The located assembly's manifest definition
    does not match the assembly reference. (Exception from HRESULT:
    0x80131040)]    ThirdPartyWebAPI.WebApiApplication.Application_Start()
    in d:\SM\7.4Test\WebAPIServerV2\ThirdPartyWebAPI\Global.asax.cs:50</p>
    
    <p>[HttpException (0x80004005): Could not load file or assembly
    'System.Web.Http, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
    located assembly's manifest definition does not match the assembly
    reference. (Exception from HRESULT: 0x80131040)]<br>
    System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
    context, HttpApplication app) +9935033<br>
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
    appContext, HttpContext context, MethodInfo[] handlers) +118<br>
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
    MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172<br>
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
    appContext, HttpContext context) +336<br>
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
    appContext) +296</p>
    
    <p>[HttpException (0x80004005): Could not load file or assembly
    'System.Web.Http, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
    located assembly's manifest definition does not match the assembly
    reference. (Exception from HRESULT: 0x80131040)]<br>
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
    +101    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
    wr, HttpContext context) +254</p>
  </blockquote>
  
  <hr>
  
  <p>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408  </p>