Meaning of path attribute on handlers in web.config

别来无恙 提交于 2019-12-05 04:06:28

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.

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