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.
newVersionto "2.0.34876.0" instead of "2.0.0.0"?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 folderGet-Project –All | Add-BindingRedirect, should straighten everything out. Test local, then make sure updated web.config get's published on the server.