分享

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

 A_POST 2013-10-29

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

复制代码
<spring>
  <context>
    <resource uri="config://spring/objects" />    
  </context>
  <objects xmlns="http://www."   xmlns:xsi="http://www./2001/XMLSchema-instance"
      xsi:schemaLocation="http://www. http://www./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>
复制代码

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多