覆盖成员时违反了继承安全规则:'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 包列表
- Autofac.3.5.2
- Autofac.Configuration.3.3.0
- Autofac.Extras.DynamicProxy2.3.0.7
- Autofac.WebApi.3.1.0
- AutoMapper.4.2.1
- Castle.Core.3.3.3
- Microsoft.AspNet.Mvc.5.2.3
- Microsoft.AspNet.Razor.3.2.3
- Microsoft.AspNet.Web.Optimization.1.1.3
- Microsoft.AspNet.WebApi.5.2.3
- Microsoft.AspNet.WebApi.Client.5.2.3
- Microsoft.AspNet.WebApi.Core.5.2.3
- Microsoft.AspNet.WebApi.WebHost.5.2.3
- Microsoft.AspNet.WebPages.3.2.3
- Microsoft.Web.Infrastructure.1.0.0.0
- Moq.4.5.8
- Newtonsoft.Json.8.0.3
- WebGrease.1.6.0
您需要使用Autofac.WebApi2 package with the latest classic Web API as outlined in the docs。 Autofac.WebApi2 的当前发行版本是 3.4.0.
我正在尝试在 .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 包列表- Autofac.3.5.2
- Autofac.Configuration.3.3.0
- Autofac.Extras.DynamicProxy2.3.0.7
- Autofac.WebApi.3.1.0
- AutoMapper.4.2.1
- Castle.Core.3.3.3
- Microsoft.AspNet.Mvc.5.2.3
- Microsoft.AspNet.Razor.3.2.3
- Microsoft.AspNet.Web.Optimization.1.1.3
- Microsoft.AspNet.WebApi.5.2.3
- Microsoft.AspNet.WebApi.Client.5.2.3
- Microsoft.AspNet.WebApi.Core.5.2.3
- Microsoft.AspNet.WebApi.WebHost.5.2.3
- Microsoft.AspNet.WebPages.3.2.3
- Microsoft.Web.Infrastructure.1.0.0.0
- Moq.4.5.8
- Newtonsoft.Json.8.0.3
- WebGrease.1.6.0
您需要使用Autofac.WebApi2 package with the latest classic Web API as outlined in the docs。 Autofac.WebApi2 的当前发行版本是 3.4.0.