【发布时间】:2017-07-04 06:12:00
【问题描述】:
以下是 WebAPI 操作。在谷歌上搜索以下错误:-
请求的资源不支持http方法'POST'
我获得了链接数量并相应地更新了我的 api,但我仍然遇到同样的错误。
- Web api not supporting POST method
-
ASP.NET Web Api: The requested resource does not support http method 'GET'
[AcceptVerbs("POST")] [HttpPost] [Route("rename/{userId}/{type}/{title}/")] public IHttpActionResult Rename([FromBody] int userId, [FromBody] string type, [FromBody] string title) { //my api stuff }
但是当通过 post man 调用上述内容时仍然会抛出错误。
我该如何摆脱这个错误??
在方法参数列表中不使用[FromBody] 属性也可以解决这个问题吗?
非常感谢任何帮助/建议。 谢谢。
【问题讨论】:
-
很可能,还有另一个动作叫做“重命名”。并且 [Route("rename/{userId}/{type}/{title}/")] 与您的请求 url 不匹配。
-
@levent,已检查。没有这样的
标签: c# asp.net-web-api postman