Reading FromUri and FromBody at the same time

后端 未结 3 847
别跟我提以往
别跟我提以往 2020-11-29 08:27

I have a new method in web api

[HttpPost]
public ApiResponse PushMessage( [FromUri] string x, [FromUri] string y, [FromBody] Request Request)
3条回答
  •  伪装坚强ぢ
    2020-11-29 08:51

    The Web API uses naming regulations. The method for a post should be started with Post.

    You should rename your PushMessage to method name PostMessage.

    Also the web api defaulty listens (depending on your route) to 'api/values/Message' and not to Pusher/Pushmessage.

    [HttpPost] attribute is not required

提交回复
热议问题