Castle Windsor PerWebRequest Error [Solved]

If you get the following error

Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule
To fix this add
to the section on your web.config.
Windsor also detected you're running IIS in Integrated Pipeline mode. This means that you also need to add the module to the section under <system.webServer>.
Alternatively make sure you have Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 assembly in your GAC (it is installed by ASP.NET MVC3 or WebMatrix) and Windsor will be able to register the module automatically without having to add anything to the config file.

and have done everything that is listed in there and still can't find the problem.

The issue is that most likely you are calling the Container.Resolve in the Application_Start method in Global.asax.cs or something like this (Before a RequestContext can be established).

This makes sense because PerWebRequest can run only in the context of a request and not outside it, which is exactly what Application_Start is.