Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The error indicates that somewhere, Ninject is trying to resolve the <code>ILoggerFactory</code> 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. </p> <p>With that in mind, your pages should be derived from <code>PageBase</code> which is an abstract class provided by the Ninject web library. That class has the following property definition:</p> <pre><code>[Inject] public ILogger Logger { get; set; } </code></pre> <p>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 <code>ILoggerFactory</code> as well as <code>ILogger</code>; however, the only binding you've provided is for <code>IDataAccess</code>. 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 <code>CreateKernel</code> function would look like this:</p> <pre><code>protected override IKernel CreateKernel() { IKernel kernel = new StandardKernel(new Log4netModule()); kernel.Bind&lt;IDataAccess&gt;().To&lt;DataAccessEntBlock&gt;().InSingletonScope(); return kernel; } </code></pre> <p>This assumes you have a <code>using Ninject.Extensions.Logging.Log4net;</code> statement in the file.</p> <p>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 <code>ILoggerFactory</code> and <code>ILogger</code> that do nothing (i.e. a "null" logger) and bind the your dummy ILoggerFactory yourself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload