views:

365

answers:

2

Hi guys,

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 (http://stackoverflow.com/questions/1136164/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  A: 

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.

Adam
I will try and post a sql script and demo project up tonight however in the mean time there has to be someone who got it working - how?
Doug
A: 

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.

Brett
Today it was stated that the new subsonic 3.1 would run fine in medium trust - i think they've solved all the issues. This is exciting as i've waited to upgrade my projects until this was done
Doug
Excellent news! Do you have a link? I knew it was a known issue but not that it is a confirmed fix for 3.1.
Brett