0
我有以下方法:的Web API - 通过双参数,以获得方法
[Route("GetEditorialRequestsByCoordinates/{lat:min(-90):max(90)}/{lng:min(-180):max(180)}")]
[AutomapperExceptionApiFilterAttribute]
public HttpResponseMessage GetEditorialRequestsByCoordinates(double lat, double lng)
{
}
,当我把它工作得很好......
GET /v1/api/request/GetEditorialRequestsByCoordinates/48/2
但我想通过这样的双重价值:
GET /v1/api/request/GetEditorialRequestsByCoordinates/48.999/2.777
我得到一个错误(404找不到)。看来,它无法通过路线找到合适的方法。 我曾试图通过的方式来设置路线:
[Route("GetEditorialRequestsByCoordinates/{lat:double:min(-90):max(90)}/{lng:double:min(-180):max(180)}")]
...但它也不起作用。
我该如何解决?
问题的一半已解决,但不适用于范围限制。我创建了另一个问题:http://stackoverflow.com/questions/36119037/webapi-min-max-double-for-routeattribute –