我有这个Web API路线:
config.Routes.MapHttpRoute(
name: "CustomerSearchApi",
routeTemplate: "api/{controller}/{action}/{criteria}",
defaults: new { criteria = RouteParameter.Optional });
这有效:
http://localhost/api/CustomerSearch/Search?criteria=sdasd
这不是:
http://localhost/api/CustomerSearch/Search/sdasd
这是我的CustomerSearchController签名:
[HttpGet]
public HttpResponseMessage Search(string criteria)
有人可以告诉我原因吗?