且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.NET Web Api:请求的资源不支持 http 方法“GET"

更新时间:2021-09-01 00:56:39

如果你没有在控制器中为你的 action 配置任何 HttpMethod,那么在 RC 中它被假定为只有 HttpPost.在 Beta 中,假定支持所有方法 - GET、PUT、POST 和 Delete.这是从 beta 到 RC 的一个小变化.您可以使用 [AcceptVerbs("GET", "POST")] 轻松地为您的操作装饰多个 httpmethod.

If you have not configured any HttpMethod on your action in controller, it is assumed to be only HttpPost in RC. In Beta, it is assumed to support all methods - GET, PUT, POST and Delete. This is a small change from beta to RC. You could easily decore more than one httpmethod on your action with [AcceptVerbs("GET", "POST")].