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"];

 

posted on 2018-06-25 16:48  荆棘人  阅读(885)  评论(0)    收藏  举报

导航