kme*_*hta 8 asp.net iis asp.net-mvc virtual-directory
我在IIS的MVC网站下有一个名为"Files"的虚拟目录.此目录与我的Views目录处于同一级别.当我从我的MVC应用程序链接到文件到我的Files目录下的文件时,我收到以下错误:
路径'/Files/Images/1c7f7eb8-5d66-4bca-a73a-4ba6340a7805.JPG'的控制器未找到或未实现IController.
它认为我的文件VD是一个控制器.如何在没有MVC干扰的情况下像普通VD一样访问我的文件?
谢谢.
Mah*_*aga 23
注册路由时,请尝试添加以下忽略规则.
public static void RegisterRoutes(RouteCollection routes)
{
/* Ignore static content, see
http://weblogs.asp.net/rashid/archive/2009/04/03/asp-net-mvc-best-practices-part-2.aspx
*/
routes.RouteExistingFiles = false;
routes.IgnoreRoute("Content/{*pathInfo}");
routes.IgnoreRoute("Scripts/{*pathInfo}");
routes.IgnoreRoute("Styles/{*pathInfo}");
routes.IgnoreRoute("{*favicon}",
new { favicon = @"(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?" });
//Ignore handlers and resources
routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// your routes go here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6409 次 |
| 最近记录: |