【发布时间】:2022-01-06 08:49:33
【问题描述】:
我有两个同名但参数不同的方法,应该返回一个HttpResponseMessage
public HttpResponseMessage ReceivedData(JObject jsonData)
和
public HttpResponseMessage ReceivedData(double longitude, double latitude)
如果我从Postman 向第二个使用 POST 请求
http://localhost:6296/api/MyController/ReceivedData?longitude=0&latitude=0
一切正常,除了第一个
http://localhost:6296/api/MyController/ReceivedData
带有 JSON 正文 {"longitude":0, "latitude":0, "otherData":"test"}
我来了
"ExceptionMessage": "Multiple actions were found that match the request
我不明白我做错了什么。
【问题讨论】:
-
您可能应该将第二个更改为 GET,而不是 POST
标签: c# postman httpresponsemessage