首页 > 解决方案 > “请求的资源不支持 http 方法 'POST'。- 邮递员

问题描述

我有一个Api控制器:UserController

在这个控制器里面我有这个方法:

[System.Web.Http.HttpPost]
[ActionName("SignUp")]
public async Task<HttpResponseMessage> Post([FromBody]FormDataCollection formData)
    {
        HttpResponseMessage MyHttpResponseMessage = new HttpResponseMessage(HttpStatusCode.InternalServerError); ....
      .....
    }

我想在 Postman 中调试它,但我总是得到这个错误:

 "Message": "The requested resource does not support http method 'POST'."

在此处输入图像描述

我试图添加只是为了url在 Postman 中以不同的方式设置,但仍然存在这个问题:

http://localhost:59694/api/user - with Post, I've deleted the `ActionName attribute` from controller.

我检查了RouteConfig.cs,我有这个:

  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

你能给些建议么?

标签: asp.net-web-apipostman

解决方案


推荐阅读