【发布时间】:2012-05-02 12:37:21
【问题描述】:
在我的 ASP.NET Web API 项目中,我在Global.asax 中定义了以下路由:
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}"
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}"
);
我有一个名为 UserFeedController 的控制器,其操作具有以下签名:
public UserFeedResponseViewModel GetUserFeed(int id)
当我输入 url http://api.mydomain.com/UserFeed/GetUserFeed/4 时,我得到一个 404。为什么第二个路由规则不适用?
MVC 路由超出了我的理解能力。
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-routing asp.net-web-api