Does NInject work on average hosting?

I am doing co-hosting with GoDaddy and I developed a sample ASP.NET MVC application using Castle Windsor and unfortunately it didn't work in the trust tool. Specifically, I got this error: "[SecurityException: This assembly does not allow partially trusted callers" ... etc. GoDaddy, unfortunately, is not flexible in its trust policy.

I am not tied to Windsor and would like to try another one that will work under Medium Trust. I'd really like to use NInject, but I've read that people have mixed success. The only one I've read that works without issue is Microsoft Unity.

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

+2


source to share


2 answers


Some DI frameworks use lightweight code generation and do not work in trust environments. NInject is one of them. You can try setting the switch UseReflectionBasedInjection

to true

, which will use reflection, which might be worth trying if performance isn't an issue for you.



+3


source


If you want Windsor to run under private trust, you currently need to build it from source using the AllowPartiallyTrustedCallersAttribute. The easiest way to do this is to use a beep, see this thread .



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

+2


source







All Articles