Inheritance security rules violated by type: "System.Net.Http.WebRequestHandler"
I have an assembly reference in the web.config file of an MVC application ...
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.0.0.0" />
</dependentAssembly>
Every time I install or update any nuget package the version number is automatically updated to 4.1.1.0. However, this breaks my application completely. It displays an error ...
Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler. Derived types must either match the accessibility security of the base type or less accessible.
I found other questions where the suggested solution is to change the version number back. This, however, does not seem particularly satisfying. There must be some underlying problem that forces me to always use the old version of this module. I am trying to find the right solution and not just constantly hack it to make it work.
Does anyone know what is actually causing this and know the correct way to fix it using the recommended versions of all packages?
source to share