Solving Autofac issue Inheritance security rules violated while overriding member GetService

纵然是瞬间 提交于 2019-12-30 07:51:51

问题


I've got an ASP.NET MVC application using Autofac.

I've added the appropriate packages via:

Install-Package Autofac
Install-Package Autofac.Mvc4

When I ran the web application, this error was throw:

Inheritance security rules violated while overriding member: 'Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(System.Type)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

How can this be solved?


回答1:


I had installed Autofac for MVC 4 when the project type was actually MVC 5.

To solve this, I ran Uninstall-Package Autofac.Mvc4 and

Install-Package Autofac.Mvc5


来源:https://stackoverflow.com/questions/22696246/solving-autofac-issue-inheritance-security-rules-violated-while-overriding-membe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!