HTTP PUT not allowed in ASP.NET Web API

Apparently, there is a known problem within AttributeRouting wherein the HttpPut methods are currently non-functional in ASP.NET Web API.

The currently accepted workaround is add the appropriate verb onto the route until a proper fix comes along:

Web API RC sealed a vital interface for route detection by the
underlying framework. Though the interface is now public, the change
won’t be released until vNext. So here are some workarounds:

  • Use AR attributes in combination with HttpGet, HttpPost, HttpPut, or HttpDelete attributes from System.Web.Http:
[GET("some/url"), HttpGet]
public string Method1() {}

[PUT("some/url"), HttpPut]
public string Method2() {}

[POST("some/url"), HttpPost]
public string Method3() {}

[DELETE("some/url"), HttpDelete]
public string Method4() {}

Leave a Comment