Asp.net-mvc – IIS7 & Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule registering problems

asp.netasp.net-mvccastle-windsoriis-7web.config

UPDATE:

In Windsor 2.5 the assembly name is Castle.Windsor not Castle.MicroKernel


I'm trying to deploy an ASP.NET MVC app to IIS7 and I'm getting this error:

Looks like you forgot to register the http module
Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule Add '' to the section on your
web.config

My httpModules contains:

<httpModules>
   <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel"/>
</httpModules>

system.webServer handlers section contains

<handlers>
  <remove name="PerRequestLifestyle"/>
  <add name="PerRequestLifestyle" preCondition="managedHandler" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Microkernel" verb="*" path="*.castle" />
</handlers>

I added the verb="*" path="*.castle" part as I was getting errors when they were missing. Not sure if their values are correct.

Anyone know what the problem is here?

Best Answer

You can solve the problem by registering the HTTP module in configuration/system.webServer/modules instead of configuration/system.web/httpModules.