【发布时间】:2009-07-01 18:45:39
【问题描述】:
我在尝试使用名称为 PropertiesController 的控制器(以及随后的路由)时遇到了一个棘手的问题(请耐心等待,因为我是 MVC 新手)。
我相信这是因为我的解决方案中有一个名为“Properties”的目录(我无法真正删除)。有没有办法解决这个问题?
路线设置只是一个简单的路线:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Properties", action = "List", id = "" } // Parameter defaults
);
我在 IIS7 中请求“http://localhost/aptment2/properties/”时遇到的错误是:
肯定有我找不到的解决方法吗?干杯。
【问题讨论】:
-
您是尝试直接浏览该视图还是先浏览 default.aspx 页面(例如使用 F5 或 Ctrl+F5)?只是好奇路由注册是否被绕过,如果您将该视图设置为起始页而不是 default.aspx。
-
刚烧了 2 个小时试图调试这个,下次必须先记住他的 SO
-
更糟糕的是 url `properties/index' 有效。
标签: asp.net asp.net-mvc iis-7 routing