【发布时间】:2016-04-28 06:49:00
【问题描述】:
我想要一个可以调用的 PUT 方法:
localhost/api/editRole/id and pass post-data.
我的路线是这样的:
routeTemplate: "api/{controller}/{action}/{id}"
然后我尝试了以下方法:
[HttpPut]
public bool editRole(int id, roleDTO postdata)
{
return dal.editRole(postdata);
}
但如果我尝试使用一些后期数据调用localhost/api/editRole/2,我会得到requested resource does not support http method 'PUT
我做错了什么?
【问题讨论】:
-
url localhost/api/editRole/2 中的控制器名称在哪里?
-
@Vermillion 检查这个答案:stackoverflow.com/questions/23502198/…
标签: c# asp.net-web-api