Subsonic 3.0 Medium Trust Issue

僤鯓⒐⒋嵵緔 提交于 2019-12-24 05:02:30

问题


I'm having an issue with running Subsonic in medium trust and don't know if i'm querying wrong - if there is some part of subsonic 3.0.3 that doesn't like medium trust can someone tell me? Someone else posted somethin similar a while ago and there was no real reply on whether it did exist or not (the bug). Rob said it had been tested, while someone else said they still had to bug (SubSonic 3.0 - Medium Trust)

i'm using a query that looks like this:

List<Data.Blog> objBlogPosts = ((from blog in db.Blogs
                                            orderby blog.blogID descending 
                                             select blog).Take(10).ToList());

and the error i'm getting is:

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"/>  

Thanks in advance. Loving the new subsonic and lambda's etc, just having issues deploying to my first shared-host :(

cheers Doug


回答1:


Subsonic WILL NOT WORK in shared hosting scenarios ( well the ones that have medium trust anyway). The problem is this line...

Func<IQueryable> fn = efn.Compile();

Maybe wait for 3.1 or go to 2.0 as subsonic is absolutely not an option at the moment. It was a great idea but it's sad the neck beards don't tell their users about this issue.

At least they taught me to include

<system.web>
    <trust level="Medium" />
</system.web>

in my web.config for any development for shared hosting sites.




回答2:


Edit - The bug is now fixed, version 3.1 will support medium trust when it's released and if you pull the latest version of the source from github and build it yourself you should find that it works in medium trust now.

Looks like you're coming up against this bug. If you can add some more details to the bug report such as the smallest possible test case that would be helpful.



来源:https://stackoverflow.com/questions/1438336/subsonic-3-0-medium-trust-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!