I have been battling this for a week now. See my previous question for some additional background.
My WPF client makes GET, POST and PUT calls to my Web API controllers. All was well for weeks. Then suddenly, all of my PUT and POST calls are coming in chunked. I cannot find any means of preventing it. I strongly suspect I made one central change that impacted everything, but I am exhausted trying to find it. I've looked back through source control and reinstated old code, and it just refuses to work.
I know of "request.Headers.TransferEncodingChunked" and it has no effect. I can explicity set it to null or false in my client, and it always arrives in my routine below as true.
My PUT/POST controller methods follow this model. The upshot for me is that my incoming objects ("User" here) arrive as null. But if I do a .ReadAsStringAsync() on the request, I get exactly the JSON expected. But I don't want to rearchitect this app around that non-intuitive pattern; the blasted objects should just arrive unchunked and ready for work!
[HttpPut]
[ResponseType(typeof(User))]
public IHttpActionResult Put([FromBody] User user)
{
if (user == null)
return Content(HttpStatusCode.BadRequest, "User data is null");
try
{
....etc.
}
}
The "User" object is an Entity Framework object, and is unremarkable. Simple string, DateTime and numeric properties.
Similarly, and just as infuriating, I can set request.Headers.AcceptEncoding to null and it arrives in my controller as Accept-Encoding: gzip, deflate.
Some links that describe the same problem and symptoms: