problem description
Local project ajax request get post put delete is normal., get post normal, put delete failed after deployment of iis. Report 405 (Method not Allowed)
related codes
function del(id) {
$.ajax({
url: "api/Products/" + id,
type: "Delete",
dataType: "json",
success: function (data) {
location.reload();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest + "," + textStatus + "," + errorThrown);
}
});
}
[HttpDelete]
[ResponseType(typeof(Product))]
public IHttpActionResult DeleteProduct(int id)
{
Product product = db.Product.Find(id);
if (product == null)
{
return NotFound();
}
db.Product.Remove(product);
db.SaveChanges();
return Ok(product);
}
error details: