I want to generate cache.manifest file automatically. Therefore I created a controller and an action accessible by /OfflineSupport/Manifest. Everything works fine. The content is delivered correctly.
Now I want to register this action when I call cache.manifest. That’s why I added a new route. My RegisterRoutes method looks as follows:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional}
);
routes.MapRoute("cache.manifest", "cache.manifest", new { controller = "OfflineSupport", action = "Manifest" });
}
My site runs under localhost:7365/. When I call localhost:7365/cache.manifest, I get a 404.0 with following detailed information:
module: IIS Web Core, message: MapRequestHandler, handler: StaticFile, errorcode: 0x80070002.
And the action is never called. Any suggestions what to change to get correct routing?
It seems as if the period is the problem. Whenever I map to a route containing a period ASP.NET MVC tries to find a physical file. When I remove the period everything works fine.
So it seems not to be possible to do what I wanted to do and I will map to routes without a period in future.