title: Could not load file or assembly System.Web.Http.WebHost
body: <p>I'm running my application on an IIS server, but now I want to do some debugging with breakpoints etc, so I decided to run from Visual Studio to IIS Express. But, when I start running my application I receive this error:</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>Could not load file or assembly 'System.Web.Http.WebHost,
    Version=5.2.3.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>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.WebHost, Version=5.2.3.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 13:<br>
    Database.SetInitializer(new
    TodoListServiceInitializer()); Line 14:<br>
    GlobalConfiguration.Configure(WebApiConfig.Register); Line 15:<br>
    } Line 16:     } Line 17: }</p>
    
    <p>Source File:
    C:\develop\spl_development\main\Docks\Docks_Sensor\Global.asax.cs<br>
    Line: 15 </p>
    
    <p>Assembly Load Trace: The following information can be helpful to
    determine why the assembly 'System.Web.Http.WebHost, Version=5.2.3.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.</p>
    
    <p>=== Pre-bind state information === LOG: DisplayName = System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35  (Fully-specified) LOG: Appbase =
    file:///C:/develop/Spl_Development/Main/Docks/Docks_Sensor/ LOG:
    Initial PrivatePath =
    C:\develop\Spl_Development\Main\Docks\Docks_Sensor\bin Calling
    assembly : Docks.Sensor, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=null.
    === LOG: This bind starts in default load context. LOG: Using application configuration file:
    C:\develop\Spl_Development\Main\Docks\Docks_Sensor\web.config LOG:
    Using host configuration file:
    C:\Users\ligthart\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.WebHost, Version=5.2.3.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting
    download of new URL
    file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
    ASP.NET Files/vs/25aafd2f/29cb2bd3/System.Web.Http.WebHost.DLL. LOG:
    Attempting download of new URL
    file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
    ASP.NET
    Files/vs/25aafd2f/29cb2bd3/System.Web.Http.WebHost/System.Web.Http.WebHost.DLL.
    LOG: Attempting download of new URL
    file:///C:/develop/Spl_Development/Main/Docks/Docks_Sensor/bin/System.Web.Http.WebHost.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: Build
    Number 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.WebHost, Version=5.2.3.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>
    Docks.Sensor.WebApiApplication.Application_Start() in
    C:\develop\spl_development\main\Docks\Docks_Sensor\Global.asax.cs:15</p>
    
    <p>[HttpException (0x80004005): Could not load file or assembly
    'System.Web.Http.WebHost, Version=5.2.3.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) +9966013<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) +352<br>
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
    appContext) +296</p>
    
    <p>[HttpException (0x80004005): Could not load file or assembly
    'System.Web.Http.WebHost, Version=5.2.3.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) +9947380 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
    +101    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
    wr, HttpContext context) +261</p>
    
    <p>Version Information: Microsoft .NET Framework Version:4.0.30319;
    ASP.NET Version:4.6.1055.0</p>
  </blockquote>
  
  <p>I've seen a lot of questions, but can't really seem to find an answer to this problem. I went looking if any of the required files or references were missing.. but no:</p>
  
  <p><strong>References:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/fik4o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fik4o.png" alt="enter image description here"></a></p>
  
  <p><strong>bin folder:</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/y9vnB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y9vnB.png" alt="enter image description here"></a></p>
  
  <p><strong>version:</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/XZt98.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XZt98.png" alt="enter image description here"></a></p>
  
  <p>I have tried to remove the bin folder, everything.. I just can't seem to get it working. I hope there's a solution, thanks in advance!</p>