I started updating some nuget packages and started getting these warnings on build with a conflict for System.Net.Http. As suggested here:
I replaced all references to System.Net.Http to use the nuget version, instead of the one bundled with Visual Studio. I then changed all redirect bindings (app.configs and web.configs) as suggested everywhere and I got things working locally. But..
When I deploy to our test server I still get the error
Could not load file or assembly 'System.Net.Http, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I´m using net 4.7.0 and Visual Studio 2017
I searched all my configs for a ref to Version 188.8.131.52 but no hits. Why does the IIS think it needs this one?
My nuget version of the System.Net.Http is 4.3.4 but the actual web.config has these lines
<dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-184.108.40.206" newVersion="220.127.116.11"/> </dependentAssembly>
Again I can build and run it locally but my server reports the error.
UPDATE: I tried adding this on my servers web.config
<dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-18.104.22.168" newVersion="22.214.171.124" /> </dependentAssembly>
That makes the error go away! But I still dont get why i need to do this? Like why do my server think it needs to use 4.2.0?
For the next person landing on this page wondering why specifying lower version makes it work checkout this answer by Ankush : https://stackoverflow.com/a/57214989/10812109
also follow this confusing thread on dotnet's github issue page: https://github.com/dotnet/runtime/issues/24382#issuecomment-350036434
User contributions licensed under CC BY-SA 3.0