I'm using .net 4.5.
The assembly System.Net.Http.Formatting uses the NewtonJson 4.5.0 assembly, doesnt it?
However, the newer version of NewtonJson (nuget) is 6.0.2.16931. I wrote the following in the web.config:
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /><bindingRedirect oldVersion="4.5.0.0" newVersion="6.0.2.16931" /></dependentAssembly></assemblyBinding></runtime>
With that in place, the following exception is thrown:
An exception of type 'System.IO.FileLoadException' occurred in System.Net.Http.Formatting.dll but was not handled in user code
Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.2.16931, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
The dll is in the bin folder of the web application. I don't know why is not working!
If I remove the bind redirect, similar exception is thrown:
An exception of type 'System.IO.FileLoadException' occurred in System.Net.Http.Formatting.dll but was not handled in user code
Additional information: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0, Culture=neutral
That's why I wrote the redirect, but it doesn't work. And I can't find the 4.5 version of the assembly!
Any ideas?