我在 MVC 应用程序的 web.config 中有以下程序集引用...
<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>
每次我安装或更新任何 nuget 包时,版本号都会自动更新为 4.1.1.0。然而,这完全破坏了我的应用程序。它显示错误...
Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'. Derived types must either match the security accessibility of the base type or be less accessible.
我发现了其他问题,建议的解决方案是再次更改版本号。然而,这似乎并不特别令人满意。一定有一些潜在的问题导致我不得不总是使用这个模块的旧版本。我试图找到一个合适的解决方案,而不是不断地破解它以使其工作。
有谁知道究竟是什么原因造成的,并且知道使用所有软件包的推荐版本修复它的正确方法?
最佳答案
我在尝试实例化 KeyVaultClient 时看到了这个错误。我能够通过安装 nuget 包 System.Net.Http v4.3.2 来修复它。
关于asp.net-mvc - 类型 : 'System.Net.Http.WebRequestHandler' 违反了继承安全规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42938814/