title: Ninject 3 in WebForms
body: <p>I'm getting an the following error when I try and start my WebForms application, with Ninject.Web (v3) installed.</p>
  
  <p><strong>"The static container already has a kernel associated with it!"</strong></p>
  
  <p>I'm implementing Ninject in Global.asax inheriting from NinjectHttpApplication and overriding CreateKernel() with my module being in the following form</p>
  
  <pre><code>public class NinjectWebModule: NinjectModule
      {
          public override void Load()
          {
              Bind&lt;IBlah&gt;().To&lt;Blah&gt;();
          }
      }
  </code></pre>
  
  <p>I basically followed the setup advice contained <a href="https://stackoverflow.com/questions/4933695/how-can-i-implement-ninject-or-di-on-asp-net-web-forms">How can I implement Ninject or DI on asp.net Web Forms?</a></p>
  
  <p>The yellow screen of pain says</p>
  
  <pre><code>[NotSupportedException: The static container already has a kernel associated with it!]
     Ninject.Web.KernelContainer.set_Kernel(IKernel value) in c:\Projects\Ninject\ninject.web\src\Ninject.Web\KernelContainer.cs:38
     Ninject.Web.NinjectWebHttpApplicationPlugin.Start() in c:\Projects\Ninject\ninject.web\src\Ninject.Web\NinjectWebHttpApplicationPlugin.cs:62
     Ninject.Web.Common.Bootstrapper.&lt;Initialize&gt;b__0(INinjectHttpApplicationPlugin c) in c:\Projects\Ninject\Ninject.Web.Common\src\Ninject.Web.Common\Bootstrapper.cs:52
     Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map(IEnumerable`1 series, Action`1 action) in c:\Projects\Ninject\ninject\src\Ninject\Infrastructure\Language\ExtensionsForIEnumerableOfT.cs:32
     Ninject.Web.Common.Bootstrapper.Initialize(Func`1 createKernelCallback) in c:\Projects\Ninject\Ninject.Web.Common\src\Ninject.Web.Common\Bootstrapper.cs:52
     Ninject.Web.Common.NinjectHttpApplication.Application_Start() in c:\Projects\Ninject\Ninject.Web.Common\src\Ninject.Web.Common\NinjectHttpApplication.cs:80
  
  [HttpException (0x80004005): The static container already has a kernel associated with it!]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
     System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
     System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
  
  [HttpException (0x80004005): The static container already has a kernel associated with it!]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
  </code></pre>
  
  <p>Any ideas?</p>