Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 638351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:43:24+00:00 2026-05-13T20:43:24+00:00

I am trying to use Ninject 2.0 with Asp .Net 3.5 web application. Following

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:43:24+00:00Added an answer on May 13, 2026 at 8:43 pm

    The error indicates that somewhere, Ninject is trying to resolve the ILoggerFactory interface to a concrete class. Based on what you’ve stated as your references above, it sounds like you’re ASP.Net web app is WebForms-based rather than an ASP.Net MVC app.

    With that in mind, your pages should be derived from PageBase which is an abstract class provided by the Ninject web library. That class has the following property definition:

    [Inject]
    public ILogger Logger { get; set; }
    

    Therefore, when your page is instantiated, Ninject is trying to inject a logger into the property on the page. As the error alludes to, you need a binding defined for the ILoggerFactory as well as ILogger; however, the only binding you’ve provided is for IDataAccess. You need to load one of the modules defined in the logging extensions library as well. I believe you can choose between NLog and Log4Net. So, for example, if you want to use Log4Net, your CreateKernel function would look like this:

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

    This assumes you have a using Ninject.Extensions.Logging.Log4net; statement in the file.

    In either case, you’ve got to select a logger and load it’s bindings (via the module) as the Ninject Web library requires it. If you don’t have any logging concerns right now, you could opt to provide implementations of ILoggerFactory and ILogger that do nothing (i.e. a “null” logger) and bind the your dummy ILoggerFactory yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to self bind MembershipProvider in ASP.NET MVC 2 and then use
I'm trying to run the following code with Ninject.Moq: [TestMethod] public void TestMethod1() {
I revieving the following error when trying use mysql_real_escape() function Fatal error: Call to
Trying to use make from cygwin using g++ I was getting Access Denied error
I am trying to use the repository pattern, ninject for DI with fluent nhibernate.
I am trying to use Ninject to implement cascading injection into a class that
I have a .Net 4.0 WCF service that I'm trying to setup ninject for.
I'm using Ninject for dependency injection in my application. Here's an example of one
Trying to use an excpetion class which could provide location reference for XML parsing,
Trying to use a guid as a resource id in a rest url but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.