如何让 IIS 7 将 .css 文件的请求路由到 aspnet_isapi.dll?
目前,我们在 IIS 6 上托管的 ASP.NET Web 应用程序上使用 DotLess。为了使其正常工作,我们需要调整 IIS 设置,以便对 *.css 文件的请求由 aspnet_isapi.dll 处理(右键单击 IIS 中的网站 -> 属性 -> 主目录选项卡 -> 配置)。
我们现在正在将此 Web 应用程序移至 IIS 7(经典模式),但似乎找不到以这种方式设置 IIS 7 的方法。有没有办法更改 IIS 7 的设置,以便像我们在 IIS 6 中所做的那样,由 aspnet_isapi.dll 处理 *.css 文件的请求?
We currently use DotLess on an ASP.NET web application hosted on IIS 6. In order to get this to work, we needed to tweak our IIS settings so that requests for *.css files would get handled by aspnet_isapi.dll (right click on website in IIS -> properties -> home directory tab -> configuration).
We're now moving this web application over to IIS 7 (classic mode) and can't seem to find a way to set up IIS 7 in this manner. Is there a way to change IIS 7's settings so that requests for *.css files get handled by aspnet_isapi.dll like we were doing in IIS 6?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你看过这个链接吗?对你有帮助吗? http://learn. iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/
实际上:IIS7 ->网站->处理程序映射 ->添加通配符脚本 在 IIS 7 经典管道模式中匹配
通配符脚本映射
使用经典管道模式,ASP.NET 作为 ISAPI 扩展插入 IIS 请求处理管道 - 与 IIS 6 中的方式完全相同。事实上,如果您打开 %WINDIR%\system32\inetsrv\config\applicationHost.config 文件并找到其中的部分,您可以看到 IIS 如何配置为将 ASP.NET 特定请求映射到aspnet_isapi.dll:
注意处理程序映射的 preCondition 属性。除此之外,此属性设置为 classicMode,这确保此处理程序映射仅在应用程序池配置为在经典模式下运行时才生效。
现在,如果要为在经典模式下运行的 ASP.NET 配置通配符映射,可以通过在 IIS 管理器中选择“处理程序映射”,然后单击“添加通配符脚本映射...”操作来完成。
Have you seen this link? Does it help you? http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/
Effectively this: IIS7 -> Web Site -> Handler Mappings -> Add Wildcard Script Match
Wildcard script mapping in IIS 7 classic pipeline mode
With classic pipeline mode the ASP.NET is plugged into the IIS request processing pipeline as an ISAPI extension - exactly the same way as it was in IIS 6. In fact, if you open %WINDIR%\system32\inetsrv\config\applicationHost.config file and locate the section inside of it you can see how IIS is configured to map ASP.NET specific requests to the aspnet_isapi.dll:
Notice the preCondition attribute for the handler mapping. Among other things this attribute is set to classicMode, which ensures that this handler mapping only takes effect when the application pool is configured to run in classic mode.
Now if you want to configure wildcard mapping for the ASP.NET running in classic mode, you can do it by choosing "Handler Mappings" in IIS Manager and then clicking on "Add Wildcard Script Map..." action.
定义一个 HttpHandler 并通过 web.config 将其连接到 iis,在本例中,我有一个名为 CssHandler 的类,它实现了 IHttpHandler 接口。
define a HttpHandler and wire it into iis via web.config, in this case I've got a class named CssHandler that implements the IHttpHandler interface.