Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving Autofac issue Inheritance security rules violated while overriding member GetService

Tags:

autofac

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?

like image 901
p.campbell Avatar asked Mar 27 '14 18:03

p.campbell


1 Answers

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 
like image 128
p.campbell Avatar answered Oct 09 '22 21:10

p.campbell