Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

546
Views
Could not load file or assembly 'System.Web.Http, Version=5.2.2.0

I added the Odata v4 package to my API, I noticed that it updated my Microsoft.AspNet.WebApi package to 5.2.3 version. But when i try to use

odata builder configuation in my WebApiConfig it showing error like 'Could not load file or assembly 'System.Web.Http, Version=5.2.2.0'.

config.MapODataServiceRoute("odata", null, GetEdmModel(), new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));

I searched this version(5.2.2) in my project but every thing is 5.2.3 and I updated all the packages too to solve this issue but failed. Copy to Local property also true for System.Web.Http dll.
Any idea?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Visual studio solved this for me. The version conflicts are shown as warning and when I clicked it automatically added the binding redirect to my web config.

https://msdn.microsoft.com/en-us/library/2fc472t2.aspx

The binding redirect that solved my issue is,

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
</assemblyBinding>
over 4 years ago · Santiago Trujillo Report

0

Well this is not "real" solution but a workaround: I have changed the machine.config and replaced <runtime /> with

  <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
        </dependentAssembly>
      </assemblyBinding>
    </runtime>

so I works but if you have other web sites running...

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!