views:

294

answers:

2

I am getting to grips with Windows Azure. I usually use NInject as my IoC container in web apps. However, when trying to use it within an Azure web role I get a security exception (something to do with reflection permission).

Has anyone used other IoC with Azure and had succcess?

+4  A: 

I just have been prototyping with Azure services today (not Web role, though). Autofac IoC Container for .NET has worked in this scenario.

Rinat Abdullin
+2  A: 

From Ninject google group: http://groups.google.com/group/ninject/browse_thread/thread/8d5a0aff853c6b4f/20209877f8db179a?show_docid=20209877f8db179a

If you set the kernel option UseReflectionBasedInjection, Ninject will work in Azure (as well as other partial trust environments):

var options = new KernelOptions { UseReflectionBasedInjection = true }; var kernel = new StandardKernel(options, new ModuleA(), new ModuleB(), ...);

Andrew Davey
I've tried to use NInject before, but it did lack fast performance support for complex container hierarchies (and transient instances) and deterministic disposal. Windsor had a couple of issues in these areas, as well.
Rinat Abdullin
The deterministic disposal story for windsor has improved recently due to the introduction of component burden.
Bittercoder