0
我有以下Web API方法:邮差和POST请求
[HttpGet]
[Route("GetUserStatus")]
public HttpResponseMessage GetUserStatus()
{
}
[HttpPost]
[Route("Send")]
public HttpResponseMessage Send(string usernameTo, string message)
{
}
当我打电话的GET请求 - 它工作正常。但是,当我尝试发送POST请求时 - 我收到一个错误:
{
"Message": "No HTTP resource was found that matches the request URI 'http://localhost:11015/api/Chat/Send'.",
"MessageDetail": "No action was found on the controller 'ChatApi' that matches the request."
}
并且该方法的失败调用计数器递增。为什么这样? 我尝试以下方法:
您的anser纠正了这个问题,但它不是邮差问题,Web Api只能从身体中取一个参数来反序列化。 –
你是对的,我不是故意暗示它是特意与邮差有关的。我把它叫出来,因为这是原始问题中使用的方法。 – ipshing