ASP.NET web-api not receiving Http Content
pHere it is a controller:/p precode[HttpPost] public void Put(string id,
[FromBody] string value) { Console.WriteLine(put query: id={0}, value={1},
id, value); data[id] = value; } /code/pre pAnd a method actually calls
it:/p precodeclient.PostAsync(string.Format(api/data/{0}, id), new
StreamContent(Utils.FromString(value))); /code/pre pwhere
codeUtils.FromString/code came from a
href=http://stackoverflow.com/questions/1879395/how-to-generate-a-stream-from-a-stringanother
question/a./p pResponse is code'No Content'/code./p pI changed
codePut/code definition:/p precode[HttpPost] public void Put(string id) {
string value = Request.Content.ReadAsStringAsync().Result; } /code/pre
pand codevalue/code is valid here./p pWhat is wrong with original
controller?/p
No comments:
Post a Comment