| View previous topic :: View next topic |
| Author |
Message |
bennage

Joined: 17 Aug 2006 Posts: 5 Location: Tallahassee, FL
|
Posted: Fri Oct 20, 2006 7:31 pm Post subject: Partial Trust issues |
|
|
I was hoping to use Monorail on a small project where the hosting is shared. I'm not using Windsor, but I am encountering a security/partial trust exception.
I'm thinking that I am probably just out of luck, but I wanted to post about it in case there is a solution.
I have not dug deeply into exactly where this exception is occuring. I assume it's related to trying to instantiate the controller.
(The host is CrystalTech.com in case anyone is curious).
The exception is:
| Code: | [SecurityException: That assembly does not allow partially trusted callers.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type) +36
System.Configuration.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) +117
System.Configuration.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) +81
System.Configuration.RuntimeConfigurationFactory..ctor(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) +240921
System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) +28
System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) +133 |
This happens when I request any url like \home\index.rails. |
|
| Back to top |
|
 |
hammett Castle Team

Joined: 15 Apr 2006 Posts: 1739 Location: SP, Brasil
|
Posted: Fri Oct 20, 2006 7:36 pm Post subject: |
|
|
I've heard that the solution is to compile castle without signing it.
From the How to build.txt:
Compiling a version not strongly signed
---------------------------------------
> nant -D:sign=false _________________ Cheers,
hammett
http://hammett.castleproject.org/ |
|
| Back to top |
|
 |
CS44
Joined: 06 Feb 2007 Posts: 6
|
Posted: Sat Mar 10, 2007 7:27 am Post subject: |
|
|
I have the same problem. In addition I tried to build last night with the "nant -D:sign=false" command and I have no luck. I am trying to use a Shared Hosting plan for this.
This is a sample of the failure output:
| Code: | [csc] c:\Program Files\CastleProject\Source Code\castle-sourcecode\Core\Castle.Core.Tests\
StreamLoggerTests.cs(26,3): error CS0246: The type or namespace name 'TestFixture' could not be found (are you missing a
using directive or an assembly reference?)
|
Please help. The site works just fine on my localhost.
-cs44 |
|
| Back to top |
|
 |
CS44
Joined: 06 Feb 2007 Posts: 6
|
Posted: Sat Mar 10, 2007 6:41 pm Post subject: |
|
|
In trying to build unsigned it appears that unless signed, castle does not build.
=(
Does anyone know a method that successfully builds unsigned? |
|
| Back to top |
|
 |
hammett Castle Team

Joined: 15 Apr 2006 Posts: 1739 Location: SP, Brasil
|
Posted: Sun Mar 11, 2007 9:16 pm Post subject: |
|
|
> nant -D:assembly.allow-partially-trusted-callers=true _________________ Cheers,
hammett
http://hammett.castleproject.org/ |
|
| Back to top |
|
 |
CS44
Joined: 06 Feb 2007 Posts: 6
|
Posted: Mon Mar 12, 2007 6:03 am Post subject: |
|
|
Hammett, thank you very much for the response. I downloaded the latest src from SVN, and I cannot build.
I have tried the following:
| Code: |
> nant -t:net-2.0 -f:release.build package-net-2.0 -D:assembly.allow-partially-trusted-callers=true
|
However, I was unable to build. The error I receive is as follows:
| Code: |
common.compile-dll:
[csc] Compiling 76 files to 'C:\Program Files\CastleProject\Source Code\fromSV
N\build\net-2.0\release\Castle.Core.dll'.
[csc] error CS2001: Source file 'Files\CastleProject\Source' could not be foun
d
[csc] error CS2001: Source file 'Code\fromSVN/CastleKey.snk' could not be foun
d
BUILD FAILED
C:\Program Files\CastleProject\Source Code\fromSVN\common-project.xml(131,5):
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (retu
rn code was 1)
Total time: 0.7 seconds.
BUILD FAILED
Nested build failed. Refer to build log for exact reason.
Total time: 0.8 seconds.
BUILD FAILED - 5 non-fatal error(s), 2 warning(s)
Nested build failed. Refer to build log for exact reason.
Total time: 1.5 seconds.
BUILD FAILED
Nested build failed. Refer to build log for exact reason.
Total time: 1.6 seconds.
|
A second attempt was:
| Code: |
> nant -t:net-2.0 -D:assembly.allow-partially-trusted-callers=true -D:s
ign=false
|
Giving:
| Code: |
[csc] Compiling 53 files to 'C:\Program Files\CastleProject\Source Code\fromSVN\build\net-2.0\debug\Castle.DynamicProxy.Tests.dll'.
[csc] c:\Program Files\CastleProject\Source Code\fromSVN\Tools\DynamicProxy\Castle.DynamicProxy.Tests\AssemblyInfoCustom.cs(21,31): error CS1726: Friend assembly reference 'DynamicAssemblyProxyGen'is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
BUILD FAILED
C:\Program Files\CastleProject\Source Code\fromSVN\common-project.xml(131,5):
External Program Failed: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe (return code was 1)
Total time: 0.8 seconds.
BUILD FAILED
Nested build failed. Refer to build log for exact reason.
Total time: 1.3 seconds.
BUILD FAILED
Nested build failed. Refer to build log for exact reason.
Total time: 1.4 seconds.
BUILD FAILED - 5 non-fatal error(s), 2 warning(s)
Nested build failed. Refer to build log for exact reason.
Total time: 7.7 seconds.
|
Also, I have have tried just 'release', which also fails.
I am a newbie when using NAnt. I have never used it before. Please let me know if you think there is a problem specific to my machine.
Thanks again,
-CS |
|
| Back to top |
|
 |
hammett Castle Team

Joined: 15 Apr 2006 Posts: 1739 Location: SP, Brasil
|
Posted: Mon Mar 12, 2007 10:51 am Post subject: |
|
|
You cannot use paths that have spaces in the name (ie \Program Files) _________________ Cheers,
hammett
http://hammett.castleproject.org/ |
|
| Back to top |
|
 |
CS44
Joined: 06 Feb 2007 Posts: 6
|
Posted: Mon Mar 12, 2007 6:25 pm Post subject: |
|
|
Hammett, with your suggestion I was able to build the latest code from SVN to the point where I can use the output. I still fail, but I believe the failure is because I am missing "wix". Also, inside facilities.build I had to comment out the following line:
| Code: |
<include name="NHibernateIntegration/NHibernateIntegration.build" />
|
NAnt command is as follows:
| Code: |
>nant -t:net-2.0 -D:assembly.allow-partially-trusted-callers=true -D:monorail.test=false -D:booview
engine.test=false -D:activerecord.test=false -D:facilities.tests=false -f:release.build package-net-2.0
|
Here is the output:
| Code: |
installer:
[nant] C:\dev\castle\fromSVN\Setup\Setup.build
Buildfile: file:///C:/dev/castle/fromSVN/Setup/Setup.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: build
set-framework-configuration:
set-net-2.0-framework-configuration:
set-project-configuration:
set-release-project-configuration:
common.init:
init:
[exec] C:\dev\castle\fromSVN\Setup\Setup.build(13,4):
[exec] '%ProgramFiles%\wix/candle.exe' failed to start.
BUILD FAILED - 1 non-fatal error(s), 0 warning(s)
C:\dev\castle\fromSVN\Setup\Setup.build(19,4):
ERROR: WiX not found, unable to create MSI
Total time: 0.1 seconds.
BUILD FAILED - 5 non-fatal error(s), 2 warning(s)
Nested build failed. Refer to build log for exact reason.
Total time: 177.7 seconds.
|
Thank you for all your help, and I believe that the build that I have is good enough for now.
-CS44 |
|
| Back to top |
|
 |
hammett Castle Team

Joined: 15 Apr 2006 Posts: 1739 Location: SP, Brasil
|
Posted: Mon Mar 12, 2007 10:17 pm Post subject: |
|
|
You don't need to specify release.build package-net-2.0
The default target will be enough. _________________ Cheers,
hammett
http://hammett.castleproject.org/ |
|
| Back to top |
|
 |
ncgoose
Joined: 12 Apr 2007 Posts: 3 Location: Chandler, AZ, USA
|
Posted: Thu Apr 12, 2007 4:33 pm Post subject: |
|
|
I must not be doing something right, I cannot get the default.build to compile correctly at all. I am getting errors trying to locate the snk file. I have downloaded the source several times and cannot find this file.
Any ideas? Do I need to generate this key file myself?
Edit:
Ok got the key from the svn repo, and now things are trying to compile but I still get errors generally concerning "Test" and if I am missing a reference or something.
I have a really neat idea, since Castle as recognized this as a issue for shared hosting, why not make a build that already has this set. I am sure this would only lead to more people using the project. I work for CrystalTech Web Hosting and am a project lead for DotNetNuke, from what I have seen so far of MonoRail, I would love to endorse it for use in shared environments. I think this product really bridges the gap between a solution like DotNetNuke and rolling your own for more nimble smaller foot print apps.
Sorry for the ramble, must be a little bit of the frustration. Overall I like all the work and want to thank you "guys" for a great job.
 |
|
| Back to top |
|
 |
henry.conceicao Site Admin
Joined: 04 Aug 2006 Posts: 769 Location: São Paulo, Brazil
|
Posted: Thu Apr 12, 2007 9:01 pm Post subject: |
|
|
Castle Project already has a support for shared enviroments (partially trusted).
Just run:
nant -D:assembly.allow-partially-trusted-callers=true
But, seems that you have been problems with the test cases. In that case, the how to build file shows how you can turn off the test cases. _________________ Cheers,
Henry Conceição
http://www.castlestronghold.com
Consultancy | Support | Training |
|
| Back to top |
|
 |
ncgoose
Joined: 12 Apr 2007 Posts: 3 Location: Chandler, AZ, USA
|
Posted: Mon Apr 16, 2007 9:09 pm Post subject: |
|
|
Henry,
yes the how to build file does show this, but what I am asking for is not a way in which potential users can do this themselves, rather a pre-built package that already has this done. This way all they have to do is download it and use it.
Also, this would be helpful for the MSI package as well. One that is already built with APTCA set. I ask this as I really like this project and I want to see it grow. One way in which to do this is make it as easy to use as possible. I realize that this is an open source project (I too work for an open source project in the form of DotNetNuke). If the projects goal is to be used and to expand it's user base, this is only a natural progression.
Also, can anyone tell me what exactly does not work with APTCA set? All of our ASP.NET 2.0 Shared hosting servers allow reflection permissions, but I would like to know what else in the Castle Project will not work. the overall goal would to make a KB article that our customers could use to help them set-up a Monorail site or to make use of the other Castle Projects.
I hope no one thinks I am being a complainer on these matters. I truly believe in the work you guys are doing and would like to help promote it in any way I can. |
|
| Back to top |
|
 |
henry.conceicao Site Admin
Joined: 04 Aug 2006 Posts: 769 Location: São Paulo, Brazil
|
Posted: Mon Apr 16, 2007 9:13 pm Post subject: |
|
|
Ok, I'll suggest it for the next release. Tks. _________________ Cheers,
Henry Conceição
http://www.castlestronghold.com
Consultancy | Support | Training |
|
| Back to top |
|
 |
ncgoose
Joined: 12 Apr 2007 Posts: 3 Location: Chandler, AZ, USA
|
Posted: Tue Apr 17, 2007 5:28 pm Post subject: |
|
|
| henry.conceicao wrote: | | Ok, I'll suggest it for the next release. Tks. |
Henry,
Thank you! You guys keep up the good work. As a little surprise we (CrystalTech) will be talking about Monorail a little bit at Mix 07, basically showing that it can in fact be installed on a shared server and used in a shared hosting environment. It is part of a larger talk about Windows Web Hosting / ASP.NET and how developers can leverage hosters. |
|
| Back to top |
|
 |
henry.conceicao Site Admin
Joined: 04 Aug 2006 Posts: 769 Location: São Paulo, Brazil
|
Posted: Wed Apr 18, 2007 2:52 pm Post subject: |
|
|
Great.
And if you need any help about the MR stuff, just ask. _________________ Cheers,
Henry Conceição
http://www.castlestronghold.com
Consultancy | Support | Training |
|
| Back to top |
|
 |
|