I have an ASP.NET project with AngularJS. I am using $http.put
to update a certain record in the database and I need the .then
to do something later.
I have an IIS server.
When I test the code locally using Visual Studio it works fine. However, once I move things to the IIS I am getting a 405 status.
the call I am using is this:
$http.put(req, oB).then(function(r) { DoSomething(oB.Id); })
The object oB is defined in the function calling this request.
the function it is calling in the controller is:
[HttpPut("{id}")]
public async Task<ActionResult> PutOb(int id, Object ob)
{
if (id != ob.Id)
{
return BadRequest();
}
var oldOb= _context.Object.Where(x => x.Id == ob.Id).FirstOrDefault();
oldOb.Name = ob.Name;
_context.Entry(oldOb).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!obExisit(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
I even tried to just call the put
without the .then
but I was still getting the same error.
Update: Activating the FailedRequestTracing got me this in the logs.