title: Ninject.ActivationException: Error activating IMainLicense
body: <p>I don't know fully how Ninject works that's why I'am asking this question here to figure out what's wrong.</p>
  
  <p><strong>If i create a empty constructor in ClaimsSecurityService it gets hit.</strong></p>
  
  <p><strong>This is my error:</strong></p>
  
  <p>Error activating IMainLicense
  No matching bindings are available, and the type is not self-bindable.
  Activation path:</p>
  
  <p>3) Injection of dependency IMainLicense into parameter mainLicenses of constructor of type ClaimsSecurityService</p>
  
  <p>2) Injection of dependency ISecurityService into parameter securityService of constructor of type AccountController</p>
  
  <p>1) Request for AccountController</p>
  
  <p>Stack:</p>
  
  <pre><code>Ninject.KernelBase.Resolve(IRequest request) +474
     Ninject.Planning.Targets.Target`1.GetValue(Type service, IContext parent) +153
     Ninject.Planning.Targets.Target`1.ResolveWithin(IContext parent) +747
     Ninject.Activation.Providers.StandardProvider.GetValue(IContext context, ITarget target) +269
     Ninject.Activation.Providers.&lt;&gt;c__DisplayClass4.&lt;Create&gt;b__2(ITarget target) +69
     System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
     System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
     System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77
     Ninject.Activation.Providers.StandardProvider.Create(IContext context) +847
     Ninject.Activation.Context.ResolveInternal(Object scope) +218
     Ninject.Activation.Context.Resolve() +277
     Ninject.&lt;&gt;c__DisplayClass15.&lt;Resolve&gt;b__f(IBinding binding) +86
     System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +145
     System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +4059897
     Ninject.Planning.Targets.Target`1.GetValue(Type service, IContext parent) +169
     Ninject.Planning.Targets.Target`1.ResolveWithin(IContext parent) +747
     Ninject.Activation.Providers.StandardProvider.GetValue(IContext context, ITarget target) +269
     Ninject.Activation.Providers.&lt;&gt;c__DisplayClass4.&lt;Create&gt;b__2(ITarget target) +69
     System.Linq.WhereSelectArrayIterator`2.MoveNext() +66
     System.Linq.Buffer`1..ctor(IEnumerable`1 source) +216
     System.Linq.Enumerable.ToArray(IEnumerable`1 source) +77
     Ninject.Activation.Providers.StandardProvider.Create(IContext context) +847
     Ninject.Activation.Context.ResolveInternal(Object scope) +218
     Ninject.Activation.Context.Resolve() +277
     Ninject.&lt;&gt;c__DisplayClass15.&lt;Resolve&gt;b__f(IBinding binding) +86
     System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +145
     System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +4059897
     Ninject.Web.Mvc.NinjectDependencyResolver.GetService(Type serviceType) +145
     System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +87
  
  [InvalidOperationException: An error occurred when trying to create a controller of type 'Successful.Struct.Web.Controllers.AccountController'. Make sure that the controller has a parameterless public constructor.]
     System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247
     System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +438
     System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +257
     System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController&amp; controller, IControllerFactory&amp; factory) +326
     System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +157
     System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>
  
  <p>Account controller:</p>
  
  <pre><code>public class AccountController : Controller
  {
      private readonly ISecurityService _securityService;
  
      public AccountController(ISecurityService securityService)
      {
          _securityService = securityService;
      }
  
      //
      // GET: /Account/Login
      [AllowAnonymous]
      public ActionResult Login(string returnUrl)
      {
          ViewBag.ReturnUrl = returnUrl;
          return View();
      }
  }
  </code></pre>
  
  <p>NinjectWebCommon:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Http;
  using System.Web.Http.Dependencies;
  using Microsoft.Web.Infrastructure.DynamicModuleHelper;
  using Ninject;
  using Ninject.Extensions.Conventions;
  using Ninject.Parameters;
  using Ninject.Syntax;
  using Ninject.Web.Common;
  using Successful.Struct.Web;
  
  [assembly: WebActivator.PreApplicationStartMethod(typeof(NinjectWebCommon), "Start")]
  [assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(NinjectWebCommon), "Stop")]
  
  namespace Successful.Struct.Web
  {
      public static class NinjectWebCommon
      {
          private static readonly Bootstrapper Bootstrapper = new Bootstrapper();
  
          /// &lt;summary&gt;
          /// Starts the application
          /// &lt;/summary&gt;
          public static void Start()
          {
              DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
              DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
              Bootstrapper.Initialize(CreateKernel);
          }
  
          /// &lt;summary&gt;
          /// Stops the application.
          /// &lt;/summary&gt;
          public static void Stop()
          {
              Bootstrapper.ShutDown();
          }
  
          /// &lt;summary&gt;
          /// Creates the kernel that will manage your application.
          /// &lt;/summary&gt;
          /// &lt;returns&gt;The created kernel.&lt;/returns&gt;
          private static IKernel CreateKernel()
          {
              var kernel = new StandardKernel();
  
              kernel.Bind&lt;Func&lt;IKernel&gt;&gt;().ToMethod(ctx =&gt; () =&gt; new Bootstrapper().Kernel);
              kernel.Bind&lt;IHttpModule&gt;().To&lt;HttpApplicationInitializationHttpModule&gt;();
              kernel.Load("Successful*.dll");
              kernel.Bind(x =&gt; x.FromAssembliesMatching("Successful*.dll")
                    .SelectAllClasses()
                    .BindAllInterfaces()
                    );
              GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(kernel);
              RegisterServices(kernel);
              return kernel;
  
          }
  
          /// &lt;summary&gt;
          /// Load your modules or register your services here!
          /// &lt;/summary&gt;
          /// &lt;param name="kernel"&gt;The kernel.&lt;/param&gt;
          private static void RegisterServices(IKernel kernel)
          {
          }
      }
  
      public class NinjectResolver : NinjectScope, IDependencyResolver
      {
          private readonly IKernel _kernel;
          public NinjectResolver(IKernel kernel)
              : base(kernel)
          {
              _kernel = kernel;
          }
          public IDependencyScope BeginScope()
          {
              return new NinjectScope(_kernel.BeginBlock());
          }
      }
  
      public class NinjectScope : IDependencyScope
      {
          protected IResolutionRoot ResolutionRoot;
          public NinjectScope(IResolutionRoot kernel)
          {
              ResolutionRoot = kernel;
          }
          public object GetService(Type serviceType)
          {
              var request = ResolutionRoot.CreateRequest(serviceType, null, new Parameter[0], true, true);
              return ResolutionRoot.Resolve(request).SingleOrDefault();
          }
          public IEnumerable&lt;object&gt; GetServices(Type serviceType)
          {
              var request = ResolutionRoot.CreateRequest(serviceType, null, new Parameter[0], true, true);
              return ResolutionRoot.Resolve(request).ToList();
          }
          public void Dispose()
          {
              var disposable = (IDisposable)ResolutionRoot;
              if (disposable != null) disposable.Dispose();
              ResolutionRoot = null;
          }
      }
  
  }
  </code></pre>
  
  <p>ClaimsSecurityService:</p>
  
  <pre><code>public class ClaimsSecurityService : ISecurityService
      {
          private const string AscClaimsIdType = "http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider";
          private const string SuccessfulStructWebNamespace = "Successful.Struct.Web";
  
          private readonly IMainLicense _mainLicenses;
          private readonly ICompany _companys;
          private readonly IAuthTokenService _authService;
  
          [Inject]
          public IApplicationContext ApplicationContext { get; set; }
          [Inject]
          public ILogger&lt;LocationService&gt; Logger { get; set; }
  
          public ClaimsSecurityService(IMainLicense mainLicenses, ICompany companys, IAuthTokenService authService)
          {
              _mainLicenses = mainLicenses;
              _companys = companys;
              _authService = authService;
          }
  }
  </code></pre>