This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
According to this post, linq won't work in medium trust. Is this still the case and if so, is there any timeline for it? Thanks.
http://www.mindscape.co.nz/blog/index.php/2009/02/15/running-lightspeed-under-medium-trust/
|
|
|
Hello Mike, That is still the case I'm afraid. We'll be trying to address this as part of our LINQ overhaul in LightSpeed 3.0, but I can't make any promises. |
|
|
Man that's a major bummer. It was my initial impression that LightSpeed did support medium trust(i.e. shared web hosting), but was just slower in it's operation. Now that I have significant portion of application built on linq it's too late for that now. Not a critical need for me right now as I was just testing out my app on a new web host, but I guess it would just be nice for it to be more clear that only part of lightspeed has medium trust support.
|
|
|
I've been doing some more testing on this and I seem to be finding that at least some LINQ queries do work after all. However, I'm not sure whether this is an artefact of my dev environment Web server granting me more permissions than a "real" medium trust environment. (It seems to fail in satisfying ways if I fail to set LightSpeedContext.UseMediumTrustCompatibility, so it's definitely restricting some permissions; just can't be sure it's restricting everything as much as a real shared Web host would.) We're going to investigate this some more but this might take a few days. So in the meantime you might want to try out your application (or a simplified test application) with your new Web host anyway. We'd be happy to receive any feedback you can provide on where failures are occurring. We can't promise that we'll be able to remove the restriction on LINQ in medium trust but we do feel a bit more positive about taking another crack at it! |
|
|
So I am running the the nightly from yesterday and have set the Medium Trust Compatibility to true in the designer. This is the specific line of code causing the error
Account = system_repo.Accounts.SingleOrDefault(a => a.Subdomain == subdomain);
I am running this app both on my local IIS7 for development and all works perfect in full trust, as well as to a production server running in full trust. When I attempt to run on shared host or just change the default setting on my local IIS7 to medium trust the stack trace below is the result. Let me know if there is anything else I can do to help. Thanks!
[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +160
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner) +37
Mindscape.LightSpeed.Utils.Reflection.(Type ) +202
Mindscape.LightSpeed.Model.TypeModel..ctor(Type , TypeModel , IEnumerable`1 ) +464
Mindscape.LightSpeed.Model.TypeModel.(Type , ICollection`1 , TypeModel , DiscriminatorAttribute[] ) +90
Mindscape.LightSpeed.Model.TypeModel.(Type , IList`1 ) +83
Mindscape.LightSpeed.Model.TypeModel.GetTypeModel(Type ) +98
..(Query , IList ) +45
Mindscape.LightSpeed.UnitOfWork.Find(Query query, IList results) +42
Mindscape.LightSpeed.UnitOfWorkBase.Find(Query query) +120
PS: I would think that medium trust compatibility is a real plus for mindscape because it opens your product up to a whole set of developers who need to build apps that run on shared hosting, or secure environments.
|
|
|
ok, what is with the formatting? None of my line breaks are showing.. maybe will try repost in IE?
|
|
|
So I am running the the nightly from yesterday and have set the Medium Trust Compatibility to true in the designer. This is the specific line of code causing the error Account = system_repo.Accounts.SingleOrDefault(a => a.Subdomain == subdomain); I am running this app both on my local IIS7 for development and all works perfect in full trust, as well as to a production server running in full trust. When I attempt to run on shared host or just change the default setting on my local IIS7 to medium trust the stack trace below is the result. Let me know if there is anything else I can do to help. Thanks!
*** I think your the post editor is not working with webkit/chrome. |
|
|
Mike, could you check in your code (not the designer) that you are setting the following: LightSpeedContext.UseMediumTrustCompatibility = true; You should be able to set this in Global.asax or somewhere (it's a static property so it doesn't need to be reset on each request). This is an additional requirement to get stuff working in medium trust. The error that you're seeing looks like it's still using the "I have full trust" code path. (The designer medium trust setting is only there because in some cases we need to generate slightly different entity code when targeting a medium trust environment; unfortunately, it doesn't set up the runtime environment. I know this is a bit confusing.) |
|
|
You are correct, and as far as I can tell all linq queries are working fine. I will notify you if I come across any linq queries that don't work. Thanks again for the assistance!
|
|