Spring.Net Resource handler for the 'web' protocol is not defined.


在ASP.NET MVC 中 Spring.NET 配置注入的時候,下面這方式是可行的。

<spring>
  <context>
    <resource uri="config://spring/objects" />    
  </context>
  <objects xmlns="http://www.springframework.net"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd"  default-autowire="byName" default-lazy-init="true">    
    <object id="CategoryDao" type="VipSoft.CMS.Dao.CategoryDao,VipSoft.CMS.Dao" singleton="false"></object>
  </objects>
</spring>

將 Objects 的內容移到單獨的文件中。

<spring>
  <context>
      <resource uri="~/Configs/Service.config" />   
  </context>  
</spring>

此時出現了 Resource handler for the 'web' protocol is not defined. 錯誤,

解決方案如下在Web.config文件中修改

<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />  
    <modules runAllManagedModulesForAllRequests="true">
      <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web" />                                          
    </modules>
    <handlers>
      <add name="Spring.WebPageHandler" path="*.aspx" verb="*" type="Spring.Web.Support.PageHandlerFactory, Spring.Web" />
      <add name="Spring.WebSupportHandler" path="ContextMonitor.ashx" verb="*" type="Spring.Web.Support.ContextMonitor, Spring.Web" />
    </handlers>        
</system.webServer>

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM