zoukankan      html  css  js  c++  java
  • asp.net Web.config 在不同版本的IIS配置的IHttpHandler的访问路径,以及经典模式和集成模式不同的配置

    如果IIS7.0使用.net4.0以上版本的框架,<system.web>中的httpHandlers节点就没有用了,而应该使用微软专为.net4.0以上版本设计的新节点<system.webServer>来配置ashx的handlers(IHttpHandler)

    handlers(IHttpHandler)在IIS7.0 .net4.0部署站点的时候使用 经典模式 应该在<system.web>节点下配置:

    1   <system.web>
    2     <httpHandlers>
    3       <remove verb="*" path="*.asmx"/>
    4       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    5       <add verb="*" path="GiftImgUpload.aspx" type="Web.Ajax_Handle.GiftImageUploadHandler, Yunsoft.Web"/>
    6       <add verb="*" path="EditPhotoHandle.aspx" type="Web.Ajax_Handle.EditPhotoHandle, Yunsoft.Web"/>
    7     </httpHandlers>
    8 </system.web>

    handlers(IHttpHandler)在IIS7.0 .net4.0部署站点的时候使用 集成模式 应该在<system.webServer>节点下配置:

     1  <system.webServer>   
     2     <handlers>
     3       <remove name="WebServiceHandlerFactory-Integrated"/>
     4       <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
     5       <add name="GiftImgUpload" verb="*" path="GiftImgUpload.aspx" type="Web.Ajax_Handle.GiftImageUploadHandler, Yunsoft.Web"/>
     6       <add name="MapHandle" verb="*" path="MapHandle.aspx" type="Web.AjaxHandle.MapHandle"/>
     7       <add name="MapMarkImgHandle" verb="*" path="MapMarkImgHandle.aspx" type="Web.AjaxHandle.MapMarkImgHandle"/>
     8       <add name="PageHandlerFactory" verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
     9     </handlers>
    10 </system.webServer>

    修改站点托管管道模式:

    说明一下:

    verb可以是“POST”或 “GET”,表示对GET或POST的请求进行处理。“*”表示对所有的请求进行处理。


    path指明相对应的文件进行处理,"*.aspx" 表示对发给所有的ASPX页面的请求进行处理,也可以指明路径,
    如,“/test/*.aspx” 表明只对test目录下的aspx文件进行处理。

    type属性中,指明要进行处理的类名,但是这个类一定要继承IHttpHandler这个接口。

  • 相关阅读:
    libmysql.lib 和 mysqlclient.lib的区别
    输入框禁止输入法
    html加后退按钮
    spry
    migration
    Ruby char <=> ASCII
    Javascript innerhtml
    My SQL 索引
    datepicker
    ruby 常用正则表达式
  • 原文地址:https://www.cnblogs.com/linJie1930906722/p/5688835.html
Copyright © 2011-2022 走看看