【发布时间】:2013-12-12 02:59:21
【问题描述】:
我有:
[RoutePrefix("teamone/players")]
..........................
[HttpPost("{key:regex([A-Za-z0-9]{32})}/AccessToken", RouteName = "MakeToken")]
public HttpResponseMessage MakeToken(string key)
{
key = key + "5555";
return new HttpResponseMessage(HttpStatusCode.OK);
}
当我尝试在 Postman REST 客户端中访问此 URL 时:
http://localhost:4566/teamone/players/243445/AccessToken
我得到一个 404。
我有
configuration.MapHttpAttributeRoutes();
我还缺少什么?同一控制器中的所有其他路由都正常工作。
【问题讨论】:
-
你在使用 MVC5 的属性路由功能吗?
标签: c# asp.net-web-api routes http-status-code-404