3

I have a project that I pulled from github that I'm trying to get working locally. I built all of the projects in the solution, and everything is fine there. However, when I try to view the site, I get a runtime error. The event viewer is giving me this message:

Exception type: HttpException 
   Exception message: 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 overridden.
   at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

I'm not sure how to fix this, I went to the file Global.asax.cs that it mentioned but line 24 looks like this:

ContainerConfig.RegisterContainer();

so that line has nothing to do with Autofac. I'm not sure what I need to change to resolve this.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Erica Stockwell-Alpert
  • 4,624
  • 10
  • 63
  • 130
  • Have you tried to search for exception message? Did you try this http://stackoverflow.com/questions/22696246/solving-autofac-issue-inheritance-security-rules-violated-while-overriding-membe? What version of Autofac MVC integration package have you installed? – abatishchev Mar 11 '15 at 18:44
  • I did see that, I tried removing my Autofac reference and installing Autofac.Mvc5 like that solution suggested, but it didn't work – Erica Stockwell-Alpert Mar 11 '15 at 18:52
  • Don't forget to cleanup solution and rebuild to avoid DLLs caching in bin – abatishchev Mar 11 '15 at 19:37
  • Is this a duplicate question with this issue? https://github.com/autofac/Autofac/issues/627 – Travis Illig Mar 12 '15 at 02:29
  • "...so that line has nothing to do with Autofac". I disagree. ContainerConfig.RegisterContainer() sounds like the point where you are composing your application, which would definitely involve Autofac. – NightOwl888 Mar 12 '15 at 02:52

0 Answers0