我刚刚将我的Asp.Net Mvc 2项目更新到Mvc 3,突然我的链接停止了工作。当我打开一个页面时,页面上的所有链接都会重定向回自身。
此外,某些重定向到过去在以前版本中工作的操作不再起作用。它一直说'路由表中没有路由匹配提供的值。'。我使用RouteDebug来查看发生了什么,但找不到任何问题。
更新
这是我正在使用的其中一条路线:
// ** Standard route. **
context.MapRoute(
"group_default", // Route name
"{language}/{organisation}/Research.aspx/{controller}/{action}/{organisationId}/{parameter}/",
// URL with parameters
new
{
area = "research",
language = "en-US",
organisation = "",
controller = "Home",
action = "Index",
organisationId = UrlParameter.Optional,
parameter = UrlParameter.Optional
}, // Parameter defaults
new[] { "Project.Web.Areas.Research.Controllers" }
);
正如您在下面的回答中所看到的,问题是由两个UrlParameter.Optional引起的。这是Mvc 3中的一个错误
答案 0 :(得分:2)
希望这会有所帮助(并节省一些时间)