title: .Net MVC 3 with Ninject and the [Inject] attribute configuration
body: <p>i replaced the <strong>HttpAplication</strong> inheritance in my <strong>Global.asax</strong> to <strong>NinjectHttpApplication</strong>:</p>
  
  <pre><code>public class Global : NinjectHttpApplication
  {
      protected override IKernel CreateKernel()
      {
          return Bootstrapper.CreateKernel();
      }
  
      protected override void OnApplicationStarted()
      {
          base.OnApplicationStarted();
          DependencyResolver.SetResolver(new NinjectDependencyResolver(CreateKernel()));
          Bootstrapper.Bootstrap();
      }
  }
  </code></pre>
  
  <p>And my CreateKernel method:</p>
  
  <pre><code>public static IKernel CreateKernel()
  {
      var kernel = new StandardKernel();
      kernel.Load(Assembly.GetExecutingAssembly());
      return kernel;
  }
  </code></pre>
  
  <p>I need to use the <strong>[Inject]</strong> attribute in my RoleService that use RoleProvider and is started by asp.net.</p>
  
  <p>All say that if I inherit from <strong>NinjectHttpApplication</strong> in my <strong>Global.asax</strong> I don't need that line: <code>DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));</code> in my <strong>OnApplicationStarted</strong> method, but without that a exception is thrown and my dependency is <strong>NULL</strong> in my RoleProvider Service.</p>
  
  <p>After all, I need that line or not? Am I doing something wrong?</p>