After reading several similar questions and trying their solution, none worked for me.
I have this controller with the same route for get
, post
and put
. The 3 work perfectly locally, but deployed on the server, PUT
returns me a 404.
Here's the code for the controller actions. All obfuscated because, its code I'm developing for a client
[Route("objects/")]
[Route("objects/{token}/")]
[Route("controller/objects/")]
[Route("controller/objects/{token}/")]
[ActionName("objects")]
[HttpGet()]
public List<Object> Objects(string token)
{
// Works perfectly, both local and deployed
}
[Route("objects/")]
[Route("objects/{token}/")]
[Route("controller/objects/")]
[Route("controller/objects/{token}/")]
[ActionName("objects")]
[HttpPost()]
public string InsertObjects([FromUri]string token, [FromBody]Newtonsoft.Json.Linq.JObject obj)
{
// Returns a 500, but at least its called. Not used for the moment
}
[Route("objects/")]
[Route("controller/objects/")]
[ActionName("objects")]
[HttpPut()]
public string RemoveObject([FromBody]Newtonsoft.Json.Linq.JObject obj)
{
// Returns a 404 deployed on server. Works perfectly locally
// If you wonder why put instead of delete for a remove action, its because we don't delete from the db, just set a field value to false
}
I have been reading that, it might be that the PUT handler is not on the config, but this is the current handler
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
As you can see, verb
is set to *
, which means it should also consider PUT
and DELETE
, right?