小编GK.*_*GK.的帖子

使用Ninject 2.0和ASP .Net 3.5

我正在尝试将Ninject 2.0与Asp .Net 3.5 Web应用程序一起使用.以下是我正在使用的DLLS及其版本.

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

在我的global.ascx.cs中,我有以下方法.

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

当我运行应用程序时,我得到以下错误.

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 …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection ninject inversion-of-control

3
推荐指数
1
解决办法
3934
查看次数