ninject/ninject.extensions.logging — Issue #6: Still getting SecurityException or no Binding was specified
Author: skfist
Created: 2011-12-23 16:03:35+00:00
State: open

Please provide any help. I'm using Nuget versions of ninject, ninject.logging and nlog and still getting this SecurityException:

> Attempt by security transparent method 'Ninject.Extensions.Logging.NLog2.Infrastructure.NLogLogger..ctor(System.Type)' to access security critical method 'NLog.LogManager.GetLogger(System.String)' failed.

> Assembly 'Ninject.Extensions.Logging.NLog2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.

I instantiate ninject in the following way:

```cs
// Load ninject modules
INinjectModule[] modules = {
new NLogModule(),
new KernelModule(),
};

// Create Ninject settings
NinjectSettings iocContainerSettings = new NinjectSettings();
iocContainerSettings.LoadExtensions = false;

// Create IOC container
iocContainerKernel = new StandardKernel(iocContainerSettings, modules);
```

I have also tried to let ninject load modules itself but in this case i'm getting No bindings specified.