我遇到了在中等信任中运行Subsonic的问题,并且不知道我是否在查询错误 - 如果亚音速3.0.3的某些部分不喜欢中等信任,有人可以告诉我吗?有人在前一段时间发布了类似的内容,并且没有真正的答复是否确实存在(错误)。 Rob说它已经过测试,而其他人说他们仍然需要bug(SubSonic 3.0 - Medium Trust)
我正在使用如下所示的查询:
List<Data.Blog> objBlogPosts = ((from blog in db.Blogs
orderby blog.blogID descending
select blog).Take(10).ToList());
我得到的错误是:
System.MethodAccessException:
System.Runtime.CompilerServices.StrongBox`1..ctor(System.__Canon) --->
System.Security.SecurityException: Request failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh)
at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh)
at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
at System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext)
at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.PermissionSet
The demand was for:
<PermissionSet class="System.Security.PermissionSet"
version="1"
Unrestricted="true"/>
提前致谢。喜欢新的亚音速和lambda等,只是将问题部署到我的第一个共享主机:(
欢呼声 道格
答案 0 :(得分:1)
编辑 - 错误现已修复,版本3.1将在发布时支持中等信任,如果您从github获取最新版本的源代码并自行构建,您应该会发现它现在以中等信任方式工作。
看起来你遇到了this bug。如果您可以在错误报告中添加更多详细信息,例如可能有用的最小测试用例。
答案 1 :(得分:1)
Subsonic将无法在共享主机方案中工作(无论如何都是具有中等信任的方案)。问题是这一行...
Func<IQueryable> fn = efn.Compile();
也许等待3.1或转到2.0,因为亚音速目前绝对不是一个选项。这是一个好主意,但令人遗憾的是,脖子上的胡须并没有告诉用户这个问题。
至少他们教我包括
<system.web>
<trust level="Medium" />
</system.web>
在我的web.config中,用于共享主机站点的任何开发。