trailing slash issue in IIS 8.5

狂风中的少年 提交于 2019-12-02 01:09:43
Nkosi

Take a look at the following. I believe this is your problem. It has to do with the .mvc extension.

ASP.NET MVC - Routing - an action with file extension

Dots in URL causes 404 with ASP.NET mvc and IIS

The problem is that IIS will handle the .mvc file as a static file and will by default not route the hypothetical .mvc file through your MVC application. IIS handles the request and your MVC code never gets a change to route to this file.

In summary, here's what the configuration looks like to make .mvc files work:

<system.webServer>
  <handlers>
    <add name="MVCFileHandler"
      path="*.mvc"
      verb="GET" type="System.Web.Handlers.TransferRequestHandler"
      preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0"  />
  </handlers>
</system.webServer>

As for it working on IIS7.5, Win 7 without any issues and not IIS 8.5.

take a look at this answer

Routing a url with extension in MVC4 won't work, tries to serve up static file

There is also <modules runAllManagedModulesForAllRequests="true"> but it doesn't seem to work for MVC4/IIS8 (used to be ok in MVC3/IIS7 IIRC). More info here. There is also a performance impact with this one as every request will route through the managed pipeline.

Hope all this helps

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