views:

456

answers:

1

I'm attempting to use Windsor and NHibernate in a medium trust environment and I'm running up against some problems with permissions. I have read through the other questions on this but I'm using Windsor's NHibernate facility which I haven't seen discussed.

For some reason there is a dependency on the Castle.Service.Transations assembly when the container starts up. This then tries to create and instance of:

Castle.Services.Transaction.CallContextActivityManager()

A security exception is raised as CallContextActivityManager tires to use SetData in System.Runtime.Remoting.Messaging.CallContext which is only allowed if you have infrastructure permission. I'm guessing that medium trust apps don't.

Does anyone know a way around this security issue in medium trust? Should I dump the NHibernate facility and register it manually with the container?

+2  A: 

You can get around this by registering the TLSActivityManager in the container (for type IActivityManager). The DefaultTransactionManager (used by NHibernateIntegrationFacility) will then use this ActivityManager instead of firing off a new CallContextActivityManager.

martijnboland
Works a treat. Thanks very much.
Keith Bloom