1

I have a .NET 4.8 (migrated from .NET 4.5.2) ASP.NET Web API that I have deployed to a dev server and it is working fine.

I take the same code and deploy it to a qa server, and I am getting the following error when I call it:

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.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)

Both servers have .NET 4.8 installed.

The web.config has the following redirection:

<dependentAssembly>
    <assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>

I look in the bin folder and Microsoft.Web.Infrastructure.dll exists, and when I check its properties, the version is v2.0.34876.0

I don't see why it is looking for v1 instead of v2, and why it would work on one server but not another.

9
  • 2
    Have you tried setting newVersion to "2.0.34876.0" instead of "2.0.0.0"? Commented Mar 20 at 18:42
  • 1
    It looks a bit like this question: stackoverflow.com/questions/13149851/… If you check packages.config, does that still contain a reference to 1.0.0.0 ? If so, follow the steps of Riaan and let us know the results. Commented Mar 20 at 19:12
  • 1
    Does this work: oldVersion="0.0.0.0-2.0.34876.0" newVersion="2.0.34876.0" assuming you are not running in debug mode/or release to match the folders IN the bin folder Commented Mar 20 at 20:29
  • 1
    Try this cmd in the Package Manager Console: Get-Project –All | Add-BindingRedirect, should straighten everything out. Test local, then make sure updated web.config get's published on the server. Commented Mar 20 at 20:37
  • 1
    This MIGHT be some dependency code FOR that newer version also in play here i.e. issue with that or it not being there etc. Commented Mar 21 at 1:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.