我有以下方法:
我有以下方法:
[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)}")]
不过它也无法正常工作。
我该如何修复它?