webapi同时支持post和get报404错误

文章:webapi设置一个Action同时支持get和post请求

这篇文章,有提供方法。参数前加上[FromUri]

[AcceptVerbs("GET", "POST")]
public HttpResponseMessage Http([FromUri]ProxyHttpParam getParam, ProxyHttpParam postParam)
{
    var res = new HttpResponseMessage(HttpStatusCode.OK);
    return res;
}

个人思考是因为路由的严格限制导致的问题。mvc中曾经碰到这种问题

临时方法是:干掉方法的参数,在方法内部进行参数接收,Request["data"];

原文地址:https://www.cnblogs.com/Tpf386/p/9225017.html