覆盖成员时违反了继承安全规则:'Autofac.Integration.WebApi.AutofacWebApiDependencyResolver.BeginScope()'

Inheritance security rules violated while overriding member: 'Autofac.Integration.WebApi.AutofacWebApiDependencyResolver.BeginScope()'

我正在尝试在 .Net 4.5.2 框架上使用 VS 2012 和 asp net web tools for vs 2012 构建 asp.net web api 2.0 应用程序;当我尝试 运行 应用程序时, 覆盖成员时违反了继承安全规则:'Autofac.Integration.WebApi.AutofacWebApiDependencyResolver.BeginScope()'。覆盖方法的安全可访问性必须与被覆盖方法的安全可访问性匹配。

我尝试更新解决方案中的所有包,添加 [assembly: SecurityRules(SecurityRuleSet.Level1)] 或 [assembly: SecurityRules(SecurityRuleSet.Level2)] 但其中 none 似乎有效。

请帮助我解决这个问题我尝试了所有以前的线程,但其中 none 个正在运行。

提前致谢。

编辑 下面是我的网站 api 项目

中引用的 nugget 包列表
  1. Autofac.3.5.2
  2. Autofac.Configuration.3.3.0
  3. Autofac.Extras.DynamicProxy2.3.​​0.7
  4. Autofac.WebApi.3.1.0
  5. AutoMapper.4.2.1
  6. Castle.Core.3.3.3
  7. Microsoft.AspNet.Mvc.5.2.3
  8. Microsoft.AspNet.Razor.3.2.3
  9. Microsoft.AspNet.Web.Optimization.1.1.3
  10. Microsoft.AspNet.WebApi.5.2.3
  11. Microsoft.AspNet.WebApi.Client.5.2.3
  12. Microsoft.AspNet.WebApi.Core.5.2.3
  13. Microsoft.AspNet.WebApi.WebHost.5.2.3
  14. Microsoft.AspNet.WebPages.3.2.3
  15. Microsoft.Web.Infrastructure.1.0.0.0
  16. Moq.4.5.8
  17. Newtonsoft.Json.8.0.3
  18. WebGrease.1.6.0

您需要使用Autofac.WebApi2 package with the latest classic Web API as outlined in the docs。 Autofac.WebApi2 的当前发行版本是 3.4.0.