title: Ninject ActivationException
body: <p>I'm getting the infamous "Error activating XYZ. No matching bindings are available blah blah blah" from Ninject 3.0.1.10 in an ASP.NET MVC project.</p>
  
  <p>The following is how I've setup my binding (very simple):</p>
  
  <pre><code>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;();
              RegisterServices(kernel);
  
              return kernel;
          }
  
          private static void RegisterServices(IKernel kernel)
          {
              string connectionString = WebConfigurationManager.ConnectionStrings["STAGING"].ConnectionString;
  
              kernel.Bind&lt;IUserAccountRepository&gt;()
                    .To&lt;SqlUserAccountRepository&gt;()
                    .WithConstructorArgument("connectionString", connectionString);
  
              kernel.Bind&lt;IRecipeRepository&gt;()
                    .To&lt;SqlRecipeRepository&gt;()
                    .WithConstructorArgument("connectionString", connectionString);
  
              kernel.Bind&lt;HomeViewModel&gt;().ToSelf();
          }
      }
  </code></pre>
  
  <p>When the controller Index action is invoked it attempts to create a HomeViewModel object as such:</p>
  
  <pre><code>public ActionResult Index()
  {
      IKernel      kernel = new StandardKernel();
      HomeViewModel model = kernel.Get&lt;HomeViewModel&gt;();
  
      ...
  </code></pre>
  
  <p>Which triggers the exception:</p>
  
  <pre><code>Error activating IRecipeRepository No matching bindings are available, and the type is not self-bindable. 
  Activation path: 
  2) Injection of dependency IRecipeRepository into parameter recipeRepository of constructor of type HomeViewModel  
  1) Request for HomeViewModel
  </code></pre>
  
  <p>But if I attempt to get an instance of HomeViewModel directly after calling kernel.Bind in RegisterServices then it works fine.</p>
  
  <p>Here's what the HomeViewModel looks like (some details removed for sake of brevity):</p>
  
  <pre><code>public class HomeViewModel
  {
      public HomeViewModel(IRecipeRepository      recipeRepository,
                           IUserAccountRepository userAccountRepository)
      {
          this.recipeRepository = recipeRepository;
          this.userAccountRepository = userAccountRepository;
      }
  
      //
      // Some details removed for sake of brevity
      //
  
      private readonly IRecipeRepository      recipeRepository;
      private readonly IUserAccountRepository userAccountRepository;
  }
  </code></pre>
  
  <p>Any idea what I'm missing? Why is the controller "special" in this case?</p>