重写成员时违反了继承安全规则:'Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(System.Type)'

时间:2015-03-11 18:39:38

标签: c# asp.net-mvc security dependency-injection autofac

我有一个项目,我从github拉出来,我正试图在本地工作。我在解决方案中构建了所有项目,一切都很好。但是,当我尝试查看该网站时,我收到运行时错误。事件查看器给了我这条消息:

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)

我不知道如何解决这个问题,我去了它提到的文件Global.asax.cs,但第24行看起来像这样:

ContainerConfig.RegisterContainer();

因此该行与Autofac无关。我不确定我需要改变什么来解决这个问题。

0 个答案:

没有答案