I have a self hosted web api that has a controller with a Post action that takes a single string argument.
Model binding is failing to set the value of the argument and it's being passed null, even though the value is correct in the HttpContent object.
Below are a Controller and a test that reproduces the issue.
This bug was filled on codeplex: http://aspnetwebstack.codeplex.com/workitem/171
UPDATE
It was not a bug, but a behavior by design. For simple types, as string, WebAPI defaults Parameter Binding to QueryString parameters. To have it inspect the Request Body, either the argument needs to be decorated with a [FromBody]
attribute or wrapped in a complex type.
See Mike Stall's post for more details on WebApi parameter binding