Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabow...@yahoo.com] 
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@ibatis.apache.org; mich...@mccurrey.com
Subject: Re: Medium Trust Environments

 

I think there is a <setting /> to turn off the IL optimizations which means you 
can't use any of the lazy loading.

 

  _____  

From: Michael McCurrey <mmccur...@gmail.com>
To: user-cs@ibatis.apache.org
Sent: Tuesday, July 28, 2009 9:02:13 PM
Subject: Re: Medium Trust Environments

I'm not around a compiler at the moment; but I do recall reading someplace that 
the Castle.DynamicProxy (old version) as is doesn't allow partially trusted 
calls.  You'd either have to link it to a version that does or ILMerge it into 
the iBatis DLL.  It's a pain.



On Tue, Jul 28, 2009 at 5:39 PM, Erin Rollenhagen 
<e...@entrepreneurialtechnologies.com> wrote:

An update: I’ve now recompiled the Ibatis.Net dlls using 
AllowPartiallyTrustedCallers and have come up with a new exception:

 

[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(Module m, 
StackCrawlMark& stackMark, Boolean skipVisibility) +191

   System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, 
Type[] parameterTypes, Module m, Boolean skipVisibility) +49

   
IBatisNet.Common.Utilities.Objects.Members.DelegatePropertySetAccessor..ctor(Type
 targetObjectType, String propName) +700

   
IBatisNet.Common.Utilities.Objects.Members.SetAccessorFactory.CreateDynamicPropertySetAccessor(Type
 targetType, String propertyName) +235

   
IBatisNet.Common.Utilities.Objects.Members.SetAccessorFactory.CreateSetAccessor(Type
 targetType, String name) +453

   
IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty.Initialize(ConfigurationScope
 configScope, Type resultClass) +336

   
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.GetChildNode(ConfigurationScope
 configScope) +1570

   
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.Initialize(ConfigurationScope
 configScope) +194

 

I’ve Googled around a bit and it seems the solution to this is making any 
members that need to be reflected public.  This doesn’t really seem realistic – 
does anyone have any ideas?

 

 

From: Michael McCurrey [mailto:mmccur...@gmail.com] 
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@ibatis.apache.org
Subject: Re: Medium Trust Environments

 

What type of ado.net driver are you using?

On Tue, Jul 28, 2009 at 4:08 PM, Erin Rollenhagen 
<e...@entrepreneurialtechnologies.com> wrote:

Hi Everyone,

 

I know I’ve brought this up before but I don’t think there was ever an answer…I 
got around it at the time by switching from a GoDaddy account to a HostMySite 
account that was running in a higher-trust environment.  Now my host has sent 
out an email saying that they’re switching to medium trust in a week.  I 
decided to test this out by setting the trust level to medium in my 
application, and sure enough, my ibatis calls no longer work.

 

I’ve tried marking the EntrepreneurialTechnologies.DatabaseHelper class (which 
calls Ibatis) with the AllowPartiallyTrustedCallers attribute and signing it, 
but to no avail.  I still get the security exception.  What I’d like to know is 
if this is something that just cannot be done, if Ibatis is fundamentally 
incompatible with medium-trust environments, or if there is a way to configure 
things so that it will run in medium trust.  Does anyone have this working 
currently?

 

If this is something obvious that I am not getting about how medium trust 
works, please forgive me.  I’ve never had to deal with this much before.  Any 
and all guidance is appreciated.

 

Here is the stack trace:

[SecurityException: That assembly does not allow partially trusted callers.]

   
EntrepreneurialTechnologies.DatabaseHelper.SelectMapperClient.selectList(String 
selectName, Object params) +0

   ET.IowaChiropracticSociety.HomePageBannerService.getActive() +82

   _DefaultPage.Page_Load(Object sender, EventArgs e) +308

   System.Web.UI.Control.OnLoad(EventArgs e) +99

   System.Web.UI.Adapters.ControlAdapter.OnLoad(EventArgs e) +15

   System.Web.UI.Control.LoadRecursive() +8683053

   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.default_aspx.ProcessRequest(HttpContext context) +37

   
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 +181

   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& 
completedSynchronously) +75

 

Thanks!

 

Erin Rollenhagen

Entrepreneurial Technologies

12257 University Avenue, Suite 200

Clive, Iowa 50325

515.440.1242

e...@entretechno.com

http://www.entretechno.com <http://www.entretechno.com/> 

 




-- 
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/




-- 
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Reply via email to