【发布时间】:2013-10-04 09:04:06
【问题描述】:
我刚刚开始学习 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.Func2) 访问安全关键类型'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.
任何人都可以说明为什么会发生这种情况?非常感谢提前和再见......
【问题讨论】:
-
这与 PagedList.Mvc 使用 System.Web.Mvc 版本 4 引用 .NET 4.0 或 2.0 编译有关。您是否有 PagedList.Mvc 的源代码,以便您可以使用版本 5 重新编译它?
标签: asp.net-mvc pagedlist