Asp.net mvc ASP.NET/IIS:告诉IIS不要检查文件是否存在
在我的Asp.net mvc ASP.NET/IIS:告诉IIS不要检查文件是否存在,asp.net-mvc,asp.net-mvc-routing,Asp.net Mvc,Asp.net Mvc Routing,在我的Global.asax.cs中,我有: routes.MapRoute("AssetCss", "css/{*path}", new { controller = "Asset", action = "Index" }); 我也有这样的看法: <link href="/css/Root/index.css" rel="stylesheet" type="text/css" /> 问题是当请求/css/Root/Index.css时,AssetControlle
Global.asax.cs
中,我有:
routes.MapRoute("AssetCss", "css/{*path}",
new { controller = "Asset", action = "Index" });
我也有这样的看法:
<link href="/css/Root/index.css" rel="stylesheet" type="text/css" />
问题是当请求/css/Root/Index.css
时,AssetController
不会调用索引。这是因为文件实际上存在于路径/css/Root/index.css
处
如果我没记错的话,IIS中有一个复选框设置,基本上是说“不要检查请求路径中是否存在文件[而是让RouteTable
处理它]。”(至少IIS 6中有。)
是否可以在我的Web.config中放入一些东西,将此IIS设置设置为true
?我如何告诉IIS让我的MVC路由处理路径,即使路径上存在文件?查看此站点。它帮助我解决了同样的问题