Login

Username

Password





Register   Reset password

Get Cuyahoga at SourceForge.net. Fast, secure and Free Open Source software downloads

Forum

Welcome Guest Search | Active Topics | Members

Running Cuyahoga under medium trust Options
martijnb
Posted: Saturday, November 3, 2007 3:37:55 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
Cuyahoga 1.5.0 doesn't work on hosts that run on medium trust.

This is because Cuyahoga uses Castle.DynamicProxy (via NHibernate and Castle.Windsor). DynamicProxy can not run under medium trust. Several people have already tried to fix this, but it seems impossible.

Removing the dependencies on the components that cause these problems is not an option because they play a key part in what gives Cuyahoga its identity (leveraging existing components that make it possible to have a clean architecture and allows us to apply the DRY principle as much as possible).

Some hosts are willing to change the trust level when asked. There are also hosts that run under full trust by default. A list of hosts can be found at http://using.castleproject.org/display/MR/Web+Hosting+Plans .

Sorry for the inconvenience.
webolize
Posted: Thursday, October 22, 2009 7:27:11 AM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2007
Posts: 44
Points: 132
Does anybody have Cuyahoga 2 to working under medium trust?

I am trying it (cuyahoga 2 rev 894) on a trial basis on a hosting company and get the following errors:

First it says that line 39 of web.config is not allowed, because the setting has been locked by the adiministrator. that line is:
[trust level="Full" originUrl="" /]

I tried setting it to Medium. But same error, saying the line is not allowed, so I completely delete the line.

The error I get after that is:

[InvalidOperationException: The container has not been initialized!]
Cuyahoga.Core.Util.IoC.get_Container() in IoC.cs:22
Cuyahoga.Core.Util.IoC.Resolve() in IoC.cs:73
Cuyahoga.Web.HttpModules.AuthenticationModule.Init(HttpApplication context) in AuthenticationModule.cs:19
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289


Also, I tried to turn logging on, but could not. I first uncommented the lines in Config/logging.config and set debug = true. Also created the /log directory. Then I noticed that there is no include for the Config/logging.config from web.config - so I threw the config info in web.config (similar to ver 1.6), but it would still not work.

If anybody has suggestions please let me know. I only have 5 more trial days left.

Thanks
martijnb
Posted: Friday, October 23, 2009 4:51:06 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
webolize wrote:

I am trying it (cuyahoga 2 rev 894) on a trial basis on a hosting company and get the following errors:

First it says that line 39 of web.config is not allowed, because the setting has been locked by the adiministrator. that line is:
[trust level="Full" originUrl="" /]

I tried setting it to Medium. But same error, saying the line is not allowed, so I completely delete the line.


Ah, we should remove that one in the deployment version. It's only there for testing purposes.

Quote:

Also, I tried to turn logging on, but could not. I first uncommented the lines in Config/logging.config and set debug = true. Also created the /log directory. Then I noticed that there is no include for the Config/logging.config from web.config - so I threw the config info in web.config (similar to ver 1.6), but it would still not work.


You don't have to throw the config in web.config. The logger is initialized from Global.asax.cs with a reference to /config/logging.config.

However, the fact that you don't see anything in the logs may also be caused by the Medium Trust setting. If I remember well, ConfigureAndWatch may not work under medium trust.
Sorry, I can't help you any further. I have only been able to test locally with the trust level set in web.config.
webolize
Posted: Tuesday, October 27, 2009 9:25:39 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2007
Posts: 44
Points: 132
Here are a couple of other things I tried unsuccessfully

- Manually threw an exception in file HttpModules/AuthenticationModule.cs on line 19 (right before the line: this._userService = IoC.Resolve[IUserService](); ), something like if !IoC.IsInitialized throw new exception...
+ YES it does throw the exception as expected

- Tried to throw an exception in Global.asax.cs on line 55 (right after Bootstrapper.InitializeContainer(); ).
Just a plain throw new Exception ...
+THIS IS NOT THROWN, because the other exception in AuthenticationModule.cs is thrown first

From what I looked up (http://msdn.microsoft.com/en-us/library/ms178473.aspx) it seems like Application_Start should be called before the HttpModules Init methods ???

On the other hand, it works fine on my local machine. (vista, iis7...)
webolize
Posted: Tuesday, October 27, 2009 9:50:46 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2007
Posts: 44
Points: 132
webolize
Posted: Thursday, October 29, 2009 1:37:38 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2007
Posts: 44
Points: 132
For my original error: InvalidOperationException: The container has not been initialized!
it was fixed when on my host when I changed to Integrated Pipleline mode.

Strangely I would of checked this right away, but on my local Vista/II7 machine, when I changed to classic mode, cuy 2 still worked, so I assumed the app pool was not a factor. Perhaps its a strange mix of their security settings and the app pool.
martijnb
Posted: Friday, October 30, 2009 12:35:57 AM

Rank: Administration
Groups: Administration , Member

Joined: 12/30/2004
Posts: 1,674
Points: 1,824
Location: Wageningen (NL)
Glad this is sorted out. In the future we'll have to perform some exhaustive testing to make sure everything works on multiple environments (classic vs integrated - full vs medium trust etc.)
mikey26254
Posted: Wednesday, April 13, 2011 8:30:25 AM
Rank: Newbie
Groups: Member

Joined: 4/13/2011
Posts: 1
Points: 3
I am a newbie. I am using version 1.6 and uploaded the files to my hosting company server. When I try to go to default.aspx, I get the following .net error. Is this related to the server trust issue? I believe it might be related to Castle. Thanks.

You must extend the HttpApplication in your web project and implement the IContainerAccessor to properly expose your container instance
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: You must extend the HttpApplication in your web project and implement the IContainerAccessor to properly expose your container instance

Source Error:

[No relevant source lines]


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a1459a7e\6f0c42b9\App_Web_ztm2rnk6.2.cs Line: 0

Stack Trace:

[Exception: You must extend the HttpApplication in your web project and implement the IContainerAccessor to properly expose your container instance]
Cuyahoga.Web.Util.ContainerAccessorUtil.GetContainer() +101
Cuyahoga.Web.UI.PageEngine..ctor() +121
ASP.custom_cuyahoga_default_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a1459a7e\6f0c42b9\App_Web_ztm2rnk6.2.cs:0
__ASP.FastObjectFactory_app_web_ztm2rnk6.Create_ASP_custom_cuyahoga_default_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a1459a7e\6f0c42b9\App_Web_ztm2rnk6.5.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Yet Another Forum.net version 1.9.0 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.