The AmazonEnvelope is an object that is deserialized from the POST content. Inside this controller I would like to read the content again so I start a task:
But I set a breakpoint and it appears that this task never returns. I never break into the 'ContinueWith' part. I have also tried this without attaching the debugger to w3wp.exe but I get the same results on the client, namely an 'InternalServerError'. Would there be a reason that I cannot read this content twice? Can I change (should I) the signature like?
public HttpResponseMessage<SubmitFeedResponse> Post()
Any suggestions as to why this is not working and what I may have misunderstood?
Assuming you are using the ReadContentPolicy as SingleObject, the ModelBinding step uses the formatters to deserialize the request's content in order to build the Action's parameters.
In this case, the model binding uses the formatters to populate the 'envelope' parameter of the Post method.
Our default formatters currently close the request stream after reading it. This is a known issue that we are planning to fix for the next release.
Thanks,
Kiran Challa
Marked as answer by Kevin Burton on Mar 21, 2012 04:57 PM
Kevin Burton
Member
79 Points
66 Posts
ReadAsStreamAsync doesn't return?
Mar 21, 2012 04:42 PM|LINK
I have a POST method in my controller that looks like:
Task contentTask = this.ControllerContext.Request.Content.ReadAsStreamAsync().ContinueWith(a => {But I set a breakpoint and it appears that this task never returns. I never break into the 'ContinueWith' part. I have also tried this without attaching the debugger to w3wp.exe but I get the same results on the client, namely an 'InternalServerError'. Would there be a reason that I cannot read this content twice? Can I change (should I) the signature like?
rkevinburton@charter.net
kevin_burton@baxter.com
Kiran Challa
Participant
1442 Points
281 Posts
Microsoft
Re: ReadAsStreamAsync doesn't return?
Mar 21, 2012 04:55 PM|LINK
Assuming you are using the ReadContentPolicy as SingleObject, the ModelBinding step uses the formatters to deserialize the request's content in order to build the Action's parameters.
In this case, the model binding uses the formatters to populate the 'envelope' parameter of the Post method.
Our default formatters currently close the request stream after reading it. This is a known issue that we are planning to fix for the next release.
Kiran Challa