zoukankan      html  css  js  c++  java
  • 自定义HttpHandler或HttpModule处理图片注意事项

    自定义HttpHandler时,有时候怎么配置都不起效,这里记录下:

    自定义完HttpHandler或HttpModule后需要再web.config中进行注册。

    注册HttpHandler在节点  <system.webServer>下:

     <handlers>
          <remove name="WebServiceHandlerFactory-Integrated"/>
          <remove name="ScriptHandlerFactory"/>
          <remove name="ScriptHandlerFactoryAppServices"/>
          <remove name="ScriptResource"/>
          <!--自定义handler-->
          <add name="pngFileHandler" path="File/*.png" verb="*" type="TestDownloadIntercept.MyHandler.MyFileHandler,TestDownloadIntercept"/>
          <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"/>
          <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </handlers>

    注册HttpModule,在节点<system.webServer>下面:

      <modules>
          <remove name="ScriptModule"/>
          <add name="MyFileModule" type="TestDownloadIntercept.MyModule.MyFileModule,TestDownloadIntercept"/>
          <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>

    在webconfig注册时,可以写在第一行,不知道是不是这个原因,我注册时,很长时间不起效。

  • 相关阅读:
    TestNG超时测试
    iOS平台如何进行app自动化测试?
    软件性能测试见解与总结
    性能测试关注点整理总结
    测试用例的设计步骤
    如何建立软件测试管理体系?
    关于手工测试,应该如何做?
    web性能测试流程
    SPASVO推出ALM(覆盖全生命周期的研发过程管理平台)免费在线体验平台
    如何使用testcenter统计开发工程师工作质量?
  • 原文地址:https://www.cnblogs.com/Tpf386/p/15163307.html
Copyright © 2011-2022 走看看