LLBL Gen Pro Medium Trust Security Issue

Posts   
 
    
NickKirsten avatar
Posts: 5
Joined: 28-Jul-2009
# Posted on: 28-Jul-2009 14:57:33   

Hi there,

I am using LLBL Gen Pro version 2.6 final to access my MS SQL 2005 database. When i run the website on my local machine it runs fine. But when I uploaded it to a different host (who is running Medium Trust security) and try to run it I get a Security Exception.

Is there a way to use LLBL Gen Pro on Medium Trust security? Perhaps one of the LLBL Gen Pro classes that I am importing is cause my app to throw this error?

If you have any advice I would appreciate it greatly.

Thanks in advance

-Nick

The error i get when I try access the data using my LLBL Gen Pro generated classes is as follows:

Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

Line 21: protected void Page_Load(object sender, EventArgs e) Line 22: { Line 23: DynamicPageCollection pages = Collections.AllMenuPages(false);

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, 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.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +225 System.Diagnostics.TraceInternal.get_Listeners() +163 System.Diagnostics.TraceInternal.WriteLine(String message, String category) +108 System.Diagnostics.Trace.WriteLine(String message, String category) +4 SD.LLBLGen.Pro.ORMSupportClasses.CollectionCore1.Clear() +72 SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) +23 SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase`1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses) +27 Collections.AllMenuPages(Boolean isSecure) in D:\Nick\Projects\Gastro\trunk\Services\Collections.cs:348 Web_Default.Page_Load(Object sender, EventArgs e) in d:\www\binerodecepticon\web59734\gi-oncology2010.org\html\Web\Default.aspx.cs:23 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 System.Web.UI.Page.ProcessRequest() +80 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +49 ASP.web_default_aspx.ProcessRequest(HttpContext context) in App_Web_3rujfgn9.0.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Jul-2009 15:17:10   

The ormsupportclasses etc. are compiled with trustlevel medium so these should work. Please compile your own generated code with the attribute: [assembly: AllowPartiallyTrustedCallers()]

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 28-Jul-2009 17:24:19   

Is this godaddy.com perhaps?

Frans Bouma | Lead developer LLBLGen Pro
NickKirsten avatar
Posts: 5
Joined: 28-Jul-2009
# Posted on: 29-Jul-2009 08:45:34   

No it is with a swedish hosting company called Binero.com

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 29-Jul-2009 09:03:32   
NickKirsten avatar
Posts: 5
Joined: 28-Jul-2009
# Posted on: 29-Jul-2009 10:15:45   

I compiled my Generated code with the "[assembly: AllowPartiallyTrustedCallers()]" but it still doesn't work. I put the call into the AssemblyInfo.cs in my generated project. Is this the correct way of doing things?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 29-Jul-2009 17:46:54   

Have you read the thread Walaa linked to and applied the suggestions of that thread?

Frans Bouma | Lead developer LLBLGen Pro
NickKirsten avatar
Posts: 5
Joined: 28-Jul-2009
# Posted on: 30-Jul-2009 08:47:32   

Yes I have but nothing seems to work cry

I asked Binero if they are somehow affiliated to GoDaddy.com but they say they aren't and they are very strict on their security policy.

Are there perhaps any other methods of getting around this issue?

Thanks again

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 30-Jul-2009 10:34:54   

NickKirsten wrote:

Yes I have but nothing seems to work cry

I asked Binero if they are somehow affiliated to GoDaddy.com but they say they aren't and they are very strict on their security policy.

Are there perhaps any other methods of getting around this issue?

Thanks again

The problem seems to originate in a tracer. If you switch off tracing completely in the application's config file, do you still experience the issue?

Frans Bouma | Lead developer LLBLGen Pro
NickKirsten avatar
Posts: 5
Joined: 28-Jul-2009
# Posted on: 30-Jul-2009 10:53:31   

Hmm yes i just tried that and it doesn't seem to work.

Man this is getting frustrating

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 30-Jul-2009 12:55:10   

NickKirsten wrote:

Hmm yes i just tried that and it doesn't seem to work.

Man this is getting frustrating

I can imagine...

the thing is though: if you switch off the tracing in web.config, do you still get the same stacktrace? (I assume you're using the latest ormsupportclasses dll )

Also, as our code is used in medium trust situations, are these hosters willing to help you even one bit? If you switch on medium trust locally, can you reproduce it or only at their site?

Frans Bouma | Lead developer LLBLGen Pro