NHibernate 2.1.2 in medium trust
Asked Answered
H

2

5

I'm trying to configure nhibernate 2.1.2 to run in medium trust, without any luck. I have tried follwing the suggestions to run in medium trust and pre-generating the proxies.

I then tried to remove all references to lazy loading setting the default-lazy="false" on all classes and bags. However this threw an exception asking me to configure the proxyfactory.factory_class

None of these methds worked as they kept throwing generic security exceptions or throwing easying that libraries do not allow AllowPartiallyTrustedCallers.

Am I using the wrong version of NHibernate if I want to run in medium trust?

Is there a specific set of binaries, or source, which I should be using.

Update:

I managed to get this to work using the steps mentioned on the castle project mailing list mentioned by carl. In addition to this I had to disable the generation of debug information for the castle and nhibernate libraries. I wrote a quick guide to the steps I took which can be found here

Hysell answered 26/3, 2010 at 10:26 Comment(0)
J
2

I am also looking for a solution to this problem. One proposed solution I've come across, here, is to get castle core, castle dynamic proxies, and Nhibernate and recompile them all (with new references to one-another with [assembly: AllowPartiallyTrustedCallers]. Does anyone know if this is the way to go (i haven't had time to try this myself)?

Jule answered 26/3, 2010 at 12:7 Comment(4)
I Found that as well and am just working through it to see if it works, if it does ill update with the results.Hysell
@John, Good, it will be interesting to see if that's the answer.Jule
This was the answer, however there was some additional things that needed to be done to get it work correctly like telling the project to not create the pdb files. Just about to write a guide of all the steps I took, just have to fix some bugs the client found first.Hysell
I did the same thing: Downloaded Castle, NHibernate and Fluent NHibernate, compiled them myself and so far it seems to be working.Jule
P
0

NHibernate needs to access your domain model, so your domain model assembly must allow access to partially trusted callers.

Add [assembly:AllowPartiallyTrustedCallers] to your AssemblyInfo file.

Professorship answered 26/3, 2010 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.