【发布时间】:2016-03-17 03:39:15
【问题描述】:
我添加了2条路线,以下是我的代码
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
name: "HandheldApi",
routeTemplate: "api/handheld/{controller}/{action}"
);
当我使用以下链接 http://localhost:64886/api/Account/Get 时,此链接对我有用 但是我使用下面的链接http://localhost:64886/api/handheld/Account/Get,服务器返回“No HTTP resource was found that match the request URI”
我该怎么办?我必须设置2条路线,因为新路线是新的映射,默认路线将被淘汰
【问题讨论】:
标签: asp.net-web-api