看起来你忘了在Windsor Castle和IIS7上注册http模块

26 asp.net-mvc iis-7 castle-windsor

我在我的一个MVC项目中使用windsor DI框架.当我尝试从Visual Studio 2008运行时,该项目工作正常.

但是,当我尝试在IIS7中运行创建应用程序的项目时,我收到以下错误消息:

看起来您忘记注册http模块Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule将"<add name ="PerRequestLifestyle"type ="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule,Castle.MicroKernel"/>'添加到您网站上的部分.配置

但是这个模块已经存在于web.config文件的httpmodule部分中.

有谁知道我必须做些什么来消除这个问题.

Evg*_*vin 45

我有同样的错误,但它是由另一个原因引起的:

我试图解决IServiceApplication_Start自定义路由类处理,但键入IService与被注册PerWebRequestLifestyle.路由子系统保持在Web请求的更高级别,并且路由处理时不存在对象.

  • 非常大+1.我也试图在我的Application_Start中兼顾PerWebRequest Lifestyles,这导致了这个错误的误报. (10认同)
  • 同样在这里.将注册移入BeginRequest解决了我的问题. (2认同)

yfe*_*lum 35

尝试将其添加到该system.webServer部分?

<configuration>
    <system.web>
        <httpModules>
            <add name="PerRequestLifestyle" type="..." />
        </httpModules>
    </system.web>
    <system.webServer>
        <modules>
            <add name="PerRequestLifestyle" type="..." />
        </modules>
    </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

  • <configuration> <br/> <system.web> <br/> <httpModules> <br/> <add name ="PerRequestLifestyle"type ="..."/> <br/> </ httpModules> <br/> </system.web> <br/> <system.webServer> <br/> <modules> <br/> <add name ="PerRequestLifestyle"type ="..."/> <br/> </ modules > <br/> </system.webServer> <br/> </ configuration> <br/> ...对我来说. (4认同)