Set handler for PDF in IIS

大憨熊 提交于 2019-12-11 18:26:55

问题


I developed an HttpHandler in order to count number of downloads for PDF files.

Now the problem is: How can I make IIS use my handler for PDF files?


回答1:


For IIS 7 it does depend on which mode you are running IIS in. Microsoft has a great tutorial on this How to: Register HTTP Handlers which goes over all the different configuration scenarios but assuming you are running IIS 7 in integrated mode and your handler is a compiled binary you would need a web.config entry similar to the following:

<configuration>
  <system.webServer>
    <handlers>
      <add name="pdfCountHandler" verb="*" 
        path="*.pdf" 
        type="<your handler class name>, <your handler assembly name>" 
        resourceType="Unspecified" />
    </handlers>
  </system.webServer>
</configuration>


来源:https://stackoverflow.com/questions/14848527/set-handler-for-pdf-in-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!