码迷,mamicode.com
首页 > Web开发 > 详细

IIS7中配置集成模式,使其可使用httpModules、httpHandlers【转】

时间:2015-10-30 13:57:28      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

http://www.cnblogs.com/catcherx/p/3330909.html

 

第一种方法:配置应用程序池

 

  在IIS7上配置应用程序池,并且将程序池的模式改为“经典”,之后一切正常。如图:

技术分享

 

第二种方法:修改web.config配置文件:

 

例如原先设置(你的环境中可能没有httpModules,httpHandlers节点)

  1. <system.web>  
  2.   
  3.     ............  
  4.   
  5.     <httpModules>  
  6.         <add name="MyModule" type="MyApp.MyModule" />  
  7.     </httpModules>  
  8.     <httpHandlers>  
  9.       <add path="*.myh" verb="GET" type="MyApp.MyHandler" />  
  10.     </httpHandlers>  
  11.    .............  
  12.   
  13. </system.web>  
<system.web>

    ............

    <httpModules>
        <add name="MyModule" type="MyApp.MyModule" />
    </httpModules>
    <httpHandlers>
      <add path="*.myh" verb="GET" type="MyApp.MyHandler" />
    </httpHandlers>
   .............

</system.web>

 在IIS7应用程序池为“集成模式”时,改为:(httpModules改为modules,httpHandlers改为Handlers了)

  1. <system.web>  
  2.   
  3.     ...........  
  4.   
  5. </system.web>  
  6.   
  7. <system.webServer>  
  8.   
  9.     <modules>  
  10.       <add name="MyModule" type="MyApp.MyModule" />        
  11.     </modules>  
  12.     <handlers>  
  13.       <add name="MyHandler" path="*.myh" verb="GET" type="MyApp.MyHandler" preCondition="integratedMode" />  
  14.     </handlers>  
  15.   
  16. </system.webServer>  
<system.web>

    ...........

</system.web>

<system.webServer>

    <modules>
      <add name="MyModule" type="MyApp.MyModule" />      
    </modules>
    <handlers>
      <add name="MyHandler" path="*.myh" verb="GET" type="MyApp.MyHandler" preCondition="integratedMode" />
    </handlers>

</system.webServer>

 (如果你的web.config没有httpModules,httpHandlers节点,则直接在节点system.webServer中添加:

   <validation validateIntegratedModeConfiguration="false" />  
这样可以禁止验证集成模式,避免错误提示。


IIS7中配置集成模式,使其可使用httpModules、httpHandlers【转】

标签:

原文地址:http://www.cnblogs.com/zhanghai/p/4922968.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!