My simple Action method below always returns JSON, regardless of having Accept header set to application/xml. Content negotiation works fine on other actions I have in this same controller.
public HttpResponseMessage GetOrder(int id) {
var orderDescription = mydbc.tbl_job_versions.AsNoTracking().Where(t => t.JobId == id)
.Select(t => new{Id = t.JobId, Description = t.Brand + " " + t.Variety + " " + t.Promotion + " " + t.MarketSegment }).FirstOrDefault ();
if (orderDescription == null) {
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
else {
return Request.CreateResponse((HttpStatusCode)200, orderDescription);
}
}
What might be causing this to not perform content negotiation and instead always return JSON?