简体   繁体   English

尝试使用安全透明方法xxx来访问安全性关键yy

[英]Attempt by security transparent method xxx to access security critical yy

I'm just starting to learn ASP.NET MVC and following an ASP.NET MVC tutorials. 我刚刚开始学习ASP.NET MVC并遵循ASP.NET MVC教程。

I'm using Visual Studio Express 2013 RC for Web and think that could be the reason for my problem, because the tutorial for paging is written using VS2012. 我正在使用Visual Studio Express 2013 RC for Web并认为这可能是我的问题的原因,因为分页教程是使用VS2012编写的。

Everything is works fine; 一切都很好; but when I add paging to one of the pages, using all the instructions in the tutorial for adding PagedList.mvc, everything compiles fine; 但是当我向其中一个页面添加分页时,使用教程中添加PagedList.mvc的所有指令,一切都编译得很好; when I get to the specific page, I receive this error message: 当我到达特定页面时,收到以下错误消息:

Attempt by security transparent method 'PagedList.Mvc.HtmlHelper.PagedListPager(System.Web.Mvc.HtmlHelper, PagedList.IPagedList, System.Func 2) to access security critical type 'System.Web.Mvc.MvcHtmlString' failed. Attempt by security transparent method 'PagedList.Mvc.HtmlHelper.PagedListPager(System.Web.Mvc.HtmlHelper, PagedList.IPagedList, System.Func 2)来访问安全关键类型'System.Web.Mvc.MvcHtmlString' failed.

Assembly 'PagedList.Mvc, Version=4.3.0.0, Culture=neutral, enter code here PublicKeyToken=abbb863e9397c5e1' 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.

Anybody can give some reason why this situation is happening? 任何人都可以说明为什么会出现这种情况? Many thanks in advance and bye ... 非常感谢提前和再见...

For me, the page was dying in the same way on Html.ActionLink helpers: 对我来说,页面在Html.ActionLink助手上以同样的方式死亡:

Attempt by security transparent method 'Microsoft.Web.Mvc.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression 1<System.Action 1>, System.String, System.Object)' to access security critical type 'System.Web.Mvc.MvcHtmlString' failed. 尝试通过安全透明方法'Microsoft.Web.Mvc.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper,System.Linq.Expressions.Expression 1<System.Action 1>,System.String,System.Object)'进行访问安全关键类型'System.Web.Mvc.MvcHtmlString'失败。

The solution was to do the following: 解决方案是执行以下操作:

Uninstall-Package Mvc4Futures

Then: 然后:

Install-Package Microsoft.AspNet.Mvc.Futures -Version 5.0.0

https://www.nuget.org/packages/Microsoft.AspNet.Mvc.Futures/5.0.0 https://www.nuget.org/packages/Microsoft.AspNet.Mvc.Futures/5.0.0

It looks like that this issue is caused by specifics of the MVC 5. 看起来这个问题是由MVC 5的细节引起的。

Check MVC5 - System.TypeAccessException error occurs when using extension methods of HtmlHelper class from external class library with AllowPartiallyTrustedCallers attribute thread to find possible solutions. 检查MVC5 - 当使用带有AllowPartiallyTrustedCallers属性线程的外部类库的HtmlHelper类的扩展方法来查找可能的解决方案时,会发生System.TypeAccessException错误

我有同样的问题,然后我更新到PagedList.Mvc.4.5.0.0,它的工作

暂无
暂无

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

相关问题 通过安全透明方法尝试访问安全关键类型失败 - Attempt by security transparent method to access security critical type failed 尝试使用安全透明方法'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;x&#39;尝试访问安全关键方法&#39;System.Runtime.InteropServices.GCHandle.Alloc(System.Object)&#39;失败 - Attempt by security transparent method 'x' to access security critical method 'System.Runtime.InteropServices.GCHandle.Alloc(System.Object)' failed 尝试通过安全透明方法&#39;system.web.mvc.preapplicationStartcode.start&#39;访问安全关键方法。 - Attempt by security transparent method 'system.web.mvc.preapplicationStartcode.start' to access security critcal method.. failed 安全透明方法'WebMatrix.WebData.PreApplicationStartCode.Start()'尝试 - Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' 安全透明方法&#39;WebMatrix.WebData.PreApplicationStartCode.Start()&#39;尝试 - Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' 通过AZURE中的安全透明方法&#39;System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()&#39;尝试 - Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' in AZURE ASP.NET尝试通过方法…访问字段&#39;System.Data.SqlClient.xxx._connection&#39;失败 - ASP.NET Attempt by method … to access field 'System.Data.SqlClient.xxx._connection' failed MVC全局方法安全性 - MVC Global Method Security
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM