Mvc路线不匹配

时间:2013-10-20 22:04:55

标签: c# asp.net-mvc asp.net-mvc-4 asp.net-mvc-routing

我在Global.asax.cs中定义了以下路由:

void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    // catalog 
    routes.MapRoute("thumbs", "Thumbnail/{extn}/{image}/{width}/{height}", new
    {
        controller = "Image",
        action = "FetchThumbnail",
        extn = "gif",
        image = MediaManager.DefaultImageGuid,
        width = 250,
        height = 200
    });
    routes.MapRoute("rfqlist", "Rfqs/", new { controller = "RfqList", action = "Index" });
    routes.MapRoute("TappDefault", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}

我不能一步一步看到他们正在注册。我有一个控制器:

 public class RfqListController : TappController

  public ActionResult Index(string rfqTitle, int? page)

如果我打电话

> https://localhost:44300/rfqlist
如果我打电话,它会发射:

> https://localhost:44300/rfqs
它是404s。我无法看到我做错了什么。这通常很容易。

1 个答案:

答案 0 :(得分:1)

你有一个rfqs控制器吗?

https://localhost:44300/rfqs匹配您的默认路由(“TappDefault”),该路由指向rfqs控制器的索引操作