Using Ninject 2.0 with ASP .Net 3.5

Posted by GK on Stack Overflow See other posts from Stack Overflow or by GK
Published on 2010-02-27T10:02:00Z Indexed on 2010/05/26 4:31 UTC
Read the original article Hit count: 725

Hi,

I am trying to use Ninject 2.0 with Asp .Net 3.5 web application. Following are the DLLS and it's versions I am using.

  • Ninject.dll - v2.0.0.0
  • Ninject.Extensions.Logging.dll v2.0.0.0
  • Ninject.Web.dll v1.0.0.0

In my global.ascx.cs I have following method.

protected override IKernel CreateKernel()
    {
        IKernel kernel = new StandardKernel();            
        kernel.Bind<IDataAccess>().To<DataAccessEntBlock>().InSingletonScope();
        return kernel;
    }

When I run the application I get following error.

Error activating ILoggerFactory
No matching bindings are available, and the type is not self-bindable.
Activation path:
 1) Request for ILoggerFactory

Suggestions:
 1) Ensure that you have defined a binding for ILoggerFactory.
 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.
 3) Ensure you have not accidentally created more than one kernel.
 4) If you are using automatic module loading, ensure the search path and filters are

correct.

I am not understanding even though I am not trying to register Logger, it seems it is trying to create it's own. How can I resolve this error ? Do I have to use any of the Ninject's extension Logger ?

Thanks GK

© Stack Overflow or respective owner

Related posts about c#

Related posts about dependency-injection