[英]Attempt by security transparent method to access security critical method failed
[英]Attempt by security transparent method to access security critical type failed
我在MVC4应用程序中遇到以下错误
Attempt by security transparent method 'Autofac.Integration.Mvc.RegistrationExtensions.RegisterControllers(Autofac.Cont ainerBuilder, System.Reflection.Assembly[])' to access security critical type 'Autofac.Builder.IRegistrationBuilder`3<System.Object,Autofac.Features.Scanning.ScanningActivatorData,Autofac.Builder.DynamicRegistrationStyle>' failed.
Assembly 'Autofac.Integration.Mvc, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da' is marked with the
AllowPartiallyTrustedCallersAttribute, and uses the level 2 security
transparency model. Level 2 transparency causes all methods in
AllowPartiallyTrustedCallers assemblies to become security transparent by
default, which may be the cause of this exception.
我尝试了以下链接中提供的其他解决方案,但它们对我都不起作用。 尝试通过安全透明方法访问安全关键方法失败
通过安全透明方法xxx尝试访问安全关键yy和https://forums.asp.net/t/1939805.aspx
请帮忙
我很确定这是版本问题。 我错误地安装了Autofac.WebApi,Autofac的版本自动为3.xx,然后问题来了。 之后,我意识到必须使用Autofac.WebApi2而不是Autofac.WebApi。 我安装了Autofac,版本升至4.6.2,然后解决了该问题。
希望能帮助到你
我将Autofac 4.0.0替换为版本Autofac 3.5.0,并将Autofac.Integration.Mvc替换为3.0.0。 这样就解决了问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.