web.config 中处理程序的路径属性的含义

发布于 2024-11-29 04:00:47 字数 400 浏览 0 评论 0原文

我正在查看 IIS7.5 配置(system.webServer/handlers)。

您知道处理程序的路径参数中 \*.\* 之间有什么区别吗? 您可以使用 file.* (匹配 file.txt 和 file.xml)或 abc.a?c (匹配 abc.abc 和 abc.asc)吗?

路径参数可以引用“文件夹”吗?像\*\f4\*.txt

给定一个 http 请求,比如

    GET \f1\f2.f3\f4\a.b.c?arg1.arg2.arg3=3&arg4.txt=1.4

路径参数尝试匹配的部分是什么?

I'm looking at IIS7.5 configuration (system.webServer/handlers).

Do you know what is the diference between \*. and \* in the path argument for handlers?
Could you use file.* (to match file.txt and file.xml) or abc.a?c (to match abc.abc and abc.asc) ?

Can the path argument make reference to the "folder"? like \*\f4\*.txt?

Given a http request like

    GET \f1\f2.f3\f4\a.b.c?arg1.arg2.arg3=3&arg4.txt=1.4

what is the part the path argument tries to match?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白云不回头 2024-12-06 04:00:47

从匹配 URL 中某些模式的意义上来说,**. 路径并不是真正的“通配符”映射。

* 处理程序处理与站点 HTTP 处理程序中已指定的任何路径(或动词/前提条件)不匹配的所有内容的请求。 HTTP 处理程序列表实际上是一个有序列表,如果按路径排序,IIS7 的 MMC 中的默认视图可能会产生误导。要查看真实的处理顺序,您应该单击右侧操作窗格中的“*查看有序列表”链接。

执行此操作时,您将看到 * 处理程序出现在最后,称为StaticFile 处理程序可能还有一些其他处理程序,例如 TRACEVerbHandlerOPTIONSVerbHandler,它们仅响应 TRACE 和通常可以忽略的 OPTIONS 动词,因为它们在正常操作下不会执行

*. 处理程序特定于 ASP.NET 4.0,并在安装 ASP.NET 时添加。 4.0。此处理程序最初不执行任何操作,仅在安装 KB980368 修补程序(也包含在 Windows 2008R2/Windows 7 Service Pack 1 中)

Thomas Marquardt 关于 *. 处理程序和无扩展 URL:

ASP.NET MVC 路由的工作原理及其对静态请求性能的影响
ASP.NET v4 如何处理无扩展 URL

这些文章最初需要吸收很多内容,您可能需要重新审视 IIS7 管道的基础知识才能理解它们(我读了几遍才理解这些内容),但要坚持下去。

The * and *. paths aren't really "wildcard" mappings in the sense of matching some pattern in your URL.

The * handler handles requests for all content that doesn't match any paths (or verbs/preconditions) already specified in the HTTP handlers for the site. The HTTP handler list is actually an ordered list, the default view in IIS7's MMC can be misleading if you sort by path. To see the true processing order you should click on the *View Ordered List" link in the right hand side Actions Pane.

When you do this you'll see that the * handler comes last and is called the StaticFile handler. There may be some others such as the TRACEVerbHandler and the OPTIONSVerbHandler which only respond to the TRACE and OPTIONS verbs which you can generally ignore as they are not executed under normal operation.

The *. handler is specific to ASP.NET 4.0 and is added when you install ASP.NET 4.0. This handler is there to provide support for extensionless URLs. Initially this handler does nothing and only comes into play when you install the KB980368 hotfix (which is also rolled into Windows 2008R2/Windows 7 Service Pack 1).

There's a couple of great articles by Thomas Marquardt about the *. handler and extensionless urls:

How ASP.NET MVC Routing Works and its Impact on the Performance of Static Requests
How Extensionless URLs Are Handled By ASP.NET v4

There's quite a lot to absorb initially in those articles and you may need to revisit the fundamentals of the IIS7 pipeline to get your head around them (it took me a few reads for the material to sink in), but stick with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文