1
我RouteConfig.cs
的HttpHandler在ASP.NET MVC 5.0
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*allaspx}", new {allaspx = @".*\.aspx(/.*)?"});
routes.IgnoreRoute("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });
routes.IgnoreRoute("{*allsvc}", new { allsvc= @".*\.svc(/.*)?" });
routes.IgnoreRoute("{*allFileAttachments}", new { allattachment = @".*\file.attachment(/.*)?" });
...
...
...
}
}
的Web.config
<configuration>
....
<system.web>
<httpHandlers>
<add path="*.attachment" verb="*" type="MyType, Namespace" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="attachmentHandler" />
<add name="attachmentHandler" verb="*" path="*.attachment" type="myType, namespace" preCondition="integratedMode" />
</handlers>
...
</system.webServer>
...
</configuration>
,當我嘗試訪問以下網址,它仍試圖找出控制器和失敗,404