gpt4 book ai didi

asp.net-mvc - 尝试通过安全透明方法 xxx 访问安全关键 yy

转载 作者:行者123 更新时间:2023-12-04 23:54:13 24 4
gpt4 key购买 nike

我刚刚开始学习 ASP.NET MVC 并遵循 ASP.NET MVC 教程。

我正在使用 Visual Studio Express 2013 RC for Web 并认为这可能是我的问题的原因,因为分页教程是使用 VS2012 编写的。

一切正常;但是当我将分页添加到其中一个页面时,使用教程中添加 PagedList.mvc 的所有说明,一切都可以正常编译;当我到达特定页面时,我收到此错误消息:
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.

任何人都可以给出一些原因,为什么会发生这种情况?非常感谢提前,再见......

最佳答案

对我来说,页面在 Html.ActionLink 上以同样的方式消亡。 helper :

Attempt by security transparent method 'Microsoft.Web.Mvc.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression1<System.Action1>, System.String, System.Object)' to access security critical type 'System.Web.Mvc.MvcHtmlString' failed.



解决方案是执行以下操作:
Uninstall-Package Mvc4Futures

然后:
Install-Package Microsoft.AspNet.Mvc.Futures -Version 5.0.0

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

关于asp.net-mvc - 尝试通过安全透明方法 xxx 访问安全关键 yy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19061380/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com