What does ExtensionlessUrlHandler do in an MVC application?

北战南征 提交于 2019-11-30 04:47:37

IIS express uses different handlers names than IIS

Add the following markup and it should disable the extensionless handlers for IIS express only

<remove name="ExtensionlessUrl-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrl-Integrated-4.0" />

You should check your web.config file. If the following setting is present

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
  </modules>    
</system.webServer>

Then, it could explain why everything is still working after deleting the ExtensionlessUrlHandler handlers.

By default the runAllManagedModulesForAllRequests is false which means that IIS does not delegate each request to managed (.NET) modules. The core module which knows how to handle extension less URL is named UrlRouting module and it is a managed (not native) module. This means that it doesn't have a chance to handle the request and IIS internally tries to handle it according to its handler mapping configuration. BTW, the default configuration treat the extensionless url as a static resource and therefore fails with 403.14 status code (in most cases)

When runAllManagedModulesForAllRequests is true any request being sent to IIS is directed to any managed module. The UrlRouting module has a change to process the request and delegate it to ASP.NET MVC.

To summarize, when running ASP.NET MVC applications you have two options

  1. runAllManagedModulesForAllRequests is false. The ExtensionlessUrlHandler must be registered
  2. runAllManagedModulesForAllRequests is true. You can delete ExtensionlessUrlHandler from the IIS handlers list
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!