Medium Trust Environments

View: New views
18 Messages — Rating Filter:   Alert me  

Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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

erin@...

http://www.entretechno.com

 


Re: Medium Trust Environments

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What type of ado.net driver are you using?

On Tue, Jul 28, 2009 at 4:08 PM, Erin Rollenhagen <erin@...> 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

erin@...

http://www.entretechno.com

 




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

RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

This might not be what you mean but I’ll take a stab at it. 

 

 I have sites using MySql.Data and sites using System.Data.  I apologize if that’s a dumb answer.  If that’s not what you were asking, let me know and I’ll try to get you the answer you need.  Thanks fo responding!

 

--Erin

 

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

http://www.entretechno.com

 




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


RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

http://www.entretechno.com

 




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


Re: Medium Trust Environments

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/

RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I will give that a shot, thank you for your help!

 

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Tuesday, July 28, 2009 8:02 PM
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Ok, I very preliminarily have some signs of hope that this might be possible.  However, I had to make several changes to the Ibatis source code so now I have this mutant project that will not match what everyone else has and will be a problem when I want to upgrade to a new version.

 

Here are the steps that I’ve completed so far:

1.       Recompiled Ibatis dlls with a strong name key and with AllowPartiallyTrustedCallers attribute set in assemlyinfo.cs

2.       Updated the references to Castle.Dynamic proxy to a newer version that allows partially trusted callers

3.       Added a custom trust.config file in the root of my website to allow Reflection within my medium trust environment and configured it in the web.config file.  This of course removed the reflection error (am I missing something, or is this a fundamental issue with medium trust and Ibatis?  I couldn’t see any way around needing Reflection permissions – I’ll just have to hope I can talk the hosting company into it)  This brought me to a securitypermissions error that I posted in a previous message.

4.       The last step: When digging into exactly where the error was occurring, I noticed that it was in the CallContextSessionStore class which has a note at the top NOT to use it in web scenarios.  I am of course using a web scenario.  So I started looking around for a different method to call on the mapper that would not call into that class.  Here is the line of code that seems to be causing the issue:

ISqlMapSession session = _sessionStore.LocalSession;

                However, a few lines below this, the code is setting the session variable to a local session if one was not set from the call to _sessionStore.LocalSession.  I decided to try removing the call to _sessionStore.LocalSession and see if that would solve my issue.  A quick recompile and voila!  The site seems to be up and running again.

 

Does anyone have any thoughts/suggestions/improvements on what I cobbled together to make this work?  I don’t want to be doing something stupid that will end up biting me a few months down the road and I don’t feel like I’m comfortable enough with Ibatis to be sure that I’m not messing something up.

 

Thanks!

--Erin

 

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Tuesday, July 28, 2009 8:02 PM
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I actually didn’t send the security exception in a previous email.  Here it is:

 

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

   IBatisNet.DataMapper.SessionStore.CallContextSessionStore.get_LocalSession() +0

   IBatisNet.DataMapper.SqlMapper.QueryForList(String statementName, Object parameterObject) +107

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

   ET.IowaChiropracticSociety.HomePageBannerService.getActive() +81

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

   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

 

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Tuesday, July 28, 2009 8:02 PM
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


Re: Medium Trust Environments

by Ron Grabowski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/

RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Carlos Peix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Erin,
 
Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.
 
Just as a warning.
 
Regards.
 
Carlos Peix


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

It’s version 1.1.5.433

 

I just downloaded it from the site a couple of days ago.

 

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Thursday, July 30, 2009 9:57 AM
To: user-cs@...
Subject: Re: Medium Trust Environments

 

Which version number of DynamicProxy did you switch to?

On Thu, Jul 30, 2009 at 7:43 AM, Erin Rollenhagen <erin@...> wrote:

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...


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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/




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


Re: Medium Trust Environments

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Which version number of DynamicProxy did you switch to?

On Thu, Jul 30, 2009 at 7:43 AM, Erin Rollenhagen <erin@...> wrote:

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...


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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/




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

RE: Medium Trust Environments

by Dustin Aleksiuk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

What do you mean by this?

 

Thanks,
Dustin

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 8:54 AM
To: user-cs@...; michael@...
Subject: RE: Medium Trust Environments

 

Erin,

 

Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.

 

Just as a warning.

 

Regards.

 

Carlos Peix

 


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Carlos Peix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Dustin,
 
Lazy loading is a very powerful optimization technique that allows you not to load full object graphs when you need just one.
 
There are a lot of articles on the web about this topic, check [1] for basic information or [2] for details on IBatis
 
 
Regards
 
Carlos Peix


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 12:00 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

What do you mean by this?

 

Thanks,
Dustin

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 8:54 AM
To: user-cs@...; michael@...
Subject: RE: Medium Trust Environments

 

Erin,

 

Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.

 

Just as a warning.

 

Regards.

 

Carlos Peix

 


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Dustin Aleksiuk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi Carlos,

 

I know what lazy loading is, I didn't understand what you meant by "resigning" it and I'm not familiar enough with chess to understand your analogy.

 

Dustin

 

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 9:51 AM
To: user-cs@...
Subject: RE: Medium Trust Environments

 

Hi Dustin,

 

Lazy loading is a very powerful optimization technique that allows you not to load full object graphs when you need just one.

 

There are a lot of articles on the web about this topic, check [1] for basic information or [2] for details on IBatis

 

[1] http://www.google.com/search?q=lazy+loading 

[2] http://www.google.com/search?q=ibatis+lazy+loading

 

Regards

 

Carlos Peix

 


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 12:00 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

What do you mean by this?

 

Thanks,
Dustin

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 8:54 AM
To: user-cs@...; michael@...
Subject: RE: Medium Trust Environments

 

Erin,

 

Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.

 

Just as a warning.

 

Regards.

 

Carlos Peix

 


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Carlos Peix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Oh, sorry for the analogy.
 
I understood that Erin was happy to solve the problem deactivating lazy loading. I tried to call his attention on the fact that lazy loading is a very powerful tool and would be bad to loose it. He should investigate further to try to make it work in his environment. Sadly I can't help him.
 
Regards
 
Carlos Peix


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 01:35 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

Hi Carlos,

 

I know what lazy loading is, I didn't understand what you meant by "resigning" it and I'm not familiar enough with chess to understand your analogy.

 

Dustin

 

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 9:51 AM
To: user-cs@...
Subject: RE: Medium Trust Environments

 

Hi Dustin,

 

Lazy loading is a very powerful optimization technique that allows you not to load full object graphs when you need just one.

 

There are a lot of articles on the web about this topic, check [1] for basic information or [2] for details on IBatis

 

[1] http://www.google.com/search?q=lazy+loading 

[2] http://www.google.com/search?q=ibatis+lazy+loading

 

Regards

 

Carlos Peix

 


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 12:00 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

What do you mean by this?

 

Thanks,
Dustin

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 8:54 AM
To: user-cs@...; michael@...
Subject: RE: Medium Trust Environments

 

Erin,

 

Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.

 

Just as a warning.

 

Regards.

 

Carlos Peix

 


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/


RE: Medium Trust Environments

by Erin Rollenhagen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I use very simple objects (it’s just a CMS) so the lazy loading is probably ok to lose.

 

Since we use shared hosting, I don’t have any control over what the host decides to allow or not allow so I have to make accommodations in my program.

 

Thank you for pointing out the potential downfalls though.

 

-Ms. Erin Rollenhagen

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 12:48 PM
To: user-cs@...
Subject: RE: Medium Trust Environments

 

Oh, sorry for the analogy.

 

I understood that Erin was happy to solve the problem deactivating lazy loading. I tried to call his attention on the fact that lazy loading is a very powerful tool and would be bad to loose it. He should investigate further to try to make it work in his environment. Sadly I can't help him.

 

Regards

 

Carlos Peix

 


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 01:35 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

Hi Carlos,

 

I know what lazy loading is, I didn't understand what you meant by "resigning" it and I'm not familiar enough with chess to understand your analogy.

 

Dustin

 

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 9:51 AM
To: user-cs@...
Subject: RE: Medium Trust Environments

 

Hi Dustin,

 

Lazy loading is a very powerful optimization technique that allows you not to load full object graphs when you need just one.

 

There are a lot of articles on the web about this topic, check [1] for basic information or [2] for details on IBatis

 

[1] http://www.google.com/search?q=lazy+loading 

[2] http://www.google.com/search?q=ibatis+lazy+loading

 

Regards

 

Carlos Peix

 


De: Dustin Aleksiuk [mailto:Dustin.Aleksiuk@...]
Enviado el: Jueves, 30 de Julio de 2009 12:00 p.m.
Para: user-cs@...
Asunto: RE: Medium Trust Environments

What do you mean by this?

 

Thanks,
Dustin

 

From: Carlos Peix [mailto:peix-listas@...]
Sent: Thursday, July 30, 2009 8:54 AM
To: user-cs@...; michael@...
Subject: RE: Medium Trust Environments

 

Erin,

 

Be careful, resigning lazy loading nowadays is equivalent to resign the Queen and two Bishops in chess.

 

Just as a warning.

 

Regards.

 

Carlos Peix

 


De: Erin Rollenhagen [mailto:erin@...]
Enviado el: Jueves, 30 de Julio de 2009 11:43 a.m.
Para: user-cs@...; michael@...
Asunto: RE: Medium Trust Environments

Bingo!!! That solved the reflection error.

 

Thank you!

 

From: Ron Grabowski [mailto:rongrabowski@...]
Sent: Wednesday, July 29, 2009 10:35 PM
To: user-cs@...; michael@...
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 <mmccurrey@...>
To: user-cs@...
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 <erin@...> 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:mmccurrey@...]
Sent: Tuesday, July 28, 2009 7:29 PM
To: user-cs@...
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 <erin@...> 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

erin@...

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/