处理IIS映射之我见

昨天碰到了一个关于IIS映射的问题,在上网查了好多资料都说的特别模糊,要不然就是只告诉你怎么配置不告诉你是干嘛的,要不然就是说的特别不清楚不知道他写的是啥,后来查了微软官方文档(真坑啊还是得自己看文档)才搞明白,下面是我对IIS处理映射的理解。

 

官方对处理映射的解释是:

Handlers are Internet Information Services (IIS) components that are configured to process requests to specific content, typically to generate a response for the request resource. For example, an ASP.NET Web page is one type of handler. You can use handlers to process requests to any resource that needs to return information to users that is not a static file. IIS provides several different handler types to support static files, Common Gateway Interface (CGI) applications, FastCGI applications, and Internet Server API (ISAPI) extensions. ASP.NET also provides support for additional handler types through the HTTP handler interface.
Developers can create custom handlers to perform special handling that you can identify using file name extensions in your application. For example, if a developer created a handler that created RSS-formatted XML, you could bind the .rss file name extension in your application to the custom handler. Developers can also create handlers that map to a specific file and can implement these handlers as native modules or as implementations of the ASP.NET IHttpHandler interface.

差不多意思就是处理映射用于对特定请求的响应,用自定义后缀来识别,之后添加你处理这个后缀需要的脚本命令,比如.exe,.dll,然后iis接收到这个请求之后会是用你指定的脚本来处理这个请求。比如说你的网站是Asp.net,但现在可能需要处理某个.php的响应,那么这个时候就要用到处理映射了。

 

详细的步骤是:

1.打开IIS,定位到你要添加处理映射的网站,点击Handler Mappings菜单后点击Add Module Mapping。

2.在下图中添加特殊请求的后缀名,比如*.php。

3.在Moudle下拉列表中选择你的Moudle,比如这个例子的FastCgiMoudle。

4.指定你的脚本处理程序路径,比如我要处理php文件所用的php-cgi.exe。

5.将指定资源放入你的web网站的目录里,比如我这个是一个index.php,那么我就把这个文件放在我的web目录里(C:\inetpub\wwwroot)。

6.测试,在路径里输入你要请求的资源,我这个例子里是(http://localhost/index.php)。

 

 

参考的官方文档地址: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/handlers/

                                 https://docs.microsoft.com/en-us/iis/configuration/system.webserver/handlers/add

转载于:https://www.cnblogs.com/junshijie/articles/9412938.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值