views:

146

answers:

2

I'm doing shared hosting with GoDaddy and I developed a sample ASP.NET MVC app using Castle Windsor and unfortunately, it didn't work in a medium trust setting. Specifically, I got this error: "[SecurityException: That assembly does not allow partially trusted callers"... etc. GoDaddy is sadly not flexible in their trust policy.

I'm not tied to Windsor and would like to try another one that will work under Medium Trust. I'd actually like to use NInject, but I've read people having mixed success. The only one I've read that works with no problem is Microsoft's Unity.

My question is, does NInject work in medium trust? If not, what are my options?

A: 

Some DI frameworks use lightweight code generation and don't work in medium trust. NInject is one of them. You may try setting the UseReflectionBasedInjection switch to true which will use reflection which might be worth a try if performance is not an issue for you.

Darin Dimitrov
A: 

If you want Windsor working under partial trust you currently have to build it from source with the AllowPartiallyTrustedCallersAttribute. The easiest way to do this is using horn, see this thread.

Otherwise take a look at Unity or AutoFac, I think they have the APTCA by default.

Mauricio Scheffer