Meaning of path attribute on handlers in web.config

你说的曾经没有我的故事 提交于 2019-12-22 04:24:26

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7039680/meaning-of-path-attribute-on-handlers-in-web-config

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