如何在IIS 7中组态HTTP处理程序? [英] How to configure an Http Handler in IIS 7?

查看:117
本文介绍了如何在IIS 7中组态HTTP处理程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我想要做的:


  1. 我创建了一个类库项目
    与本次实施的类
    IHttpHandler接口。让我们
    调用这个类ZipHandler。让我们
    说命名空间是邮编。

  2. 我想,只要任何HTTP
    请求来自一个zip文件,我
    ZipHandler应该处理它,
    不管该请求是否是
    以一个Asp.Net应用程序或
    正常的虚拟目录。

查询:


  1. 是否有可能(应给予
    关于集成管道炒作
    等在IIS 7中)?

  2. 怎么办呢?


解决方案

下面就是我一直在寻找的信息:


  

如果要注册您的自定义
  在IIS 7 Web服务器的HTTP处理程序
  水平,必须编译你的HTTP
  处理器连接到一个强命名程序集
  并将其部署到全局程序集
  缓存(GAC),因为IIS 7只精选
  高达部署到GAC组件。它
  不拿起部署组件
  其他地方,如垃圾桶
  特定网站的目录或
  Web应用程序。


我们的目标在Web服务器级别添加该处理程序。在部署GAC处理程序后,打开可在web.config在Web服务器级别(右键点击浏览 - >打开web.config在这里展示),并放置在处理器部分是这样的(完全合格的名称之类的):

 <&处理GT;
<添加名称=Ch8_RssHandler路径=* RSS。动词=*
键入=ProIIS7AspNetIntegProgCh8.RssHandler,版本= 1.0.0.0,文化=中立,
公钥= 369d834a77preCondition =integratedMode/>
< /处理器>

请注意:信息片段(第1位和code样品)从书中采取:结果
专业IIS 7和ASP.Net集成编程由沙赫拉姆霍斯拉维博士

似乎是一个非常不错的书:)

Here's what I want to do:

  1. I've created a class library project and this has a class implementing the IHttpHandler interface. Let's call this class ZipHandler. Let's say the namespace is Zip.
  2. I want that whenever any Http request comes for a zip file, my ZipHandler should handle it, regardless of whether the request is to an Asp.Net application or a normal virtual directory.

Queries:

  1. Is it possible (it should be given the hype about integrated pipeline etc. in IIS 7)?
  2. How to do it?

解决方案

Here's the info I was looking for:

If you want to register your custom HTTP handler at the IIS 7 Web server level, you must compile your HTTP handler into a strongly-named assembly and deploy it to the Global Assembly Cache (GAC) because IIS 7 only picks up assemblies deployed to the GAC. It does not pick up assemblies deployed anywhere else such as the bin directory of a particular Web site or Web application.

We're aiming to add this handler at web server level. After deploying the handler in GAC, open the web.config available at the web server level (right click and browse -> open the web.config show here) and put something like this in the handler section (the fully qualified name of the class):

<handlers>
<add name="Ch8_RssHandler" path="*.rss" verb="*"
type="ProIIS7AspNetIntegProgCh8.RssHandler, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=369d834a77" preCondition="integratedMode" />
</handlers>

Note: The information snippets (1st para and code sample) are taken from the book:
Professional IIS 7 and ASP.Net Integrated Programming by Dr. Shahram Khosravi

Seems like a very nice book :)

这篇关于如何在IIS 7中组态HTTP处理程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆