简体   繁体   English

通过安全透明方法尝试访问安全关键类型失败

[英]Attempt by security transparent method to access security critical type failed

I am getting below error in MVC4 application 我在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.

I tried different solutions given in below links but none of them work for me Attempt by security transparent method to access security critical method failed 我尝试了以下链接中提供的其他解决方案,但它们对我都不起作用。 尝试通过安全透明方法访问安全关键方法失败

Attempt by security transparent method xxx to access security critical yy and https://forums.asp.net/t/1939805.aspx 通过安全透明方法xxx尝试访问安全关键yyhttps://forums.asp.net/t/1939805.aspx

Please help 请帮忙

I am pretty sure this is the version issue. 我很确定这是版本问题。 I installed Autofac.WebApi by mistake, the version of Autofac was automatically 3.xx Then the issue came. 我错误地安装了Autofac.WebApi,Autofac的版本自动为3.xx,然后问题来了。 After that I realized I had to use Autofac.WebApi2 instead of Autofac.WebApi. 之后,我意识到必须使用Autofac.WebApi2而不是Autofac.WebApi。 I installed, Autofac version went up to 4.6.2, then booom the issue was solved. 我安装了Autofac,版本升至4.6.2,然后解决了该问题。

Hope it helps 希望能帮助到你

I replaced Autofac 4.0.0 with version Autofac 3.5.0 and Autofac.Integration.Mvc to 3.0.0. 我将Autofac 4.0.0替换为版本Autofac 3.5.0,并将Autofac.Integration.Mvc替换为3.0.0。 This resolved the problem 这样就解决了问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试通过安全透明方法访问安全关键方法失败 - Attempt by security transparent method to access security critical method failed 尝试通过安全透明方法&#39;Compat.Button1_Click(System.Object,System.EventArgs)&#39;访问安全关键方法&#39;x&#39;失败 - Attempt by security transparent method 'Compat.Button1_Click(System.Object, System.EventArgs)' to access security critical method 'x' failed System.MethodAccessException:尝试通过安全透明方法访问安全性关键方法在所有应用程序上失败 - System.MethodAccessException: Attempt by security transparent method to access security critical method fails on all applications 尝试使用安全透明方法'Microsoft.Web.Helpers.PreApplicationStartCode.Start()'来访问安全关键方法 - Attempt by security transparent method 'Microsoft.Web.Helpers.PreApplicationStartCode.Start()' to access security critical method 尝试使用安全透明方法&#39;System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()&#39;来访问安全关键 - Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical 尝试通过安全透明方法&#39;system.web.mvc.preapplicationStartcode.start&#39;访问安全关键方法。 - Attempt by security transparent method 'system.web.mvc.preapplicationStartcode.start' to access security critcal method.. failed 通过安全透明方法异常尝试 - Attempt by security transparent method exception 异常“通过安全透明方法&#39;NPOI.OpenXml4Net.OPC.ZipPackage尝试” - Exception “Attempt by security transparent method 'NPOI.OpenXml4Net.OPC.ZipPackage” CA2140。 透明代码不得引用安全关键项 - CA2140. Transparent code must not reference security critical items PageListPaper Html帮助程序抛出错误“安全关键类型&#39;System.Web.Mvc.MvcHtmlString&#39;失败” - PageListPaper Html helper throws an error “security critical type 'System.Web.Mvc.MvcHtmlString' failed”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM