创建上下文'spring.root'内部异常时出错:网站支持模块未初始化



我有一个 ASP.NET Web应用程序,它可以编译和使用一些引用,如Spring.WebSpring.CoreSpring.AopSpring.CoreSpring.Services。相应的dll位于bin文件夹中。当我使用 Internet Explorer 启动 Web 应用程序时,出现以下异常:

Error creating context 'spring.root': An exception occurred in the type initializer of 'Spring.Objects.Factory.Support.WebObjectFactory'.
the inner exception
TypeInitializationException: An exception occurred in the type initializer of 'Spring.Objects.Factory.Support.WebObjectFactory'.
ConfigurationErrorsException: WebSupportModule not initialized. Did you forget to add <add name = "Spring" type = "Spring.Context.Support.WebSupportModule, Spring.Web" /> to your web.config's <httpModules> -section?

这是我的webConfig的相关部分

on httpModules><br>
i put the add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <br>
i put the add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>  <br>
i put the add name="BRF" type="BRF.Core.Web.BRFHttpModule, BRF.Core.Web"/><br>
this is the end of httpModules> <br>

但我做对了,所以我不理解为什么会发生例外。 我能做什么?

对你来说太晚了,但这也会提醒我未来的自己。

正如您在Web.config中所知道的,您需要有此部分

<httpModules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
</httpModules>

但是您还需要在该文件中具有另一个部分

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
</modules>
</system.webServer>

最新更新