2
[HttpDelete]
public HttpResponseMessage Delete(string id)
{ 
    string status = "";
    int _id = Convert.ToInt16(id);
    tbl_machinedieselInfo data= db.tbl_machinedieselInfo.Where(x=>x.Id==_id).FirstOrDefault();
    if (data.Id > 0)
    {
        db.tbl_machinedieselInfo.Remove(data);
        db.SaveChanges();
        status = "Deleted";
    }
    else {
        status = "Bad Request";
    }
    return Request.CreateResponse(HttpStatusCode.OK, status);
}

I try to delete record using above api but it throws an error("HTTP Error 405"), for testing these api I am using postman and fiddler, it works properly on local host but does not work on IIS, please help.

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76

0 Answers0