Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just posting the findings here - as a summary of the chat - since others may get this error. Don't hand out bounty, since I didn't actually find the solution. ;-)</p> <p>The error itself is a result of trying to access <code>BinaryRead</code>, <code>Form</code>, <code>Files</code> or <code>InputStream</code> after something else has already accessed the request entity body stream (in other words, the content of the request) using a different method.</p> <p>These "different methods" seem to include <code>GetBufferedInputStream</code> and <code>GetBufferlessInputStream</code>. These methods <em>appear</em> (not sure) to all be mutually exclusive. In other words, for a single request, you can only use one of:</p> <ul> <li><code>BinaryRead()</code>, <code>Form</code>, <code>Files</code>, <code>InputStream</code> (these will "cooperate" with each other),</li> <li><code>GetBufferedInputStream()</code>, or</li> <li><code>GetBufferlessInputStream()</code></li> </ul> <p><code>GetBufferedInputStream</code> <em>should</em> cooperate with the "classic" access methods, <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.getbufferedinputstream.aspx">according to the documentation</a> - in fact, that's its only difference from <code>GetBufferlessInputStream</code>. Nonetheless, in this case, the error stems from <code>GetBufferedInputStream()</code> being used, followed by <code>InputStream</code>.</p> <p>The different methods are (inadequately) described in the documentation for the <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.readentitybodymode.aspx">ReadEntityBodyMode property</a> and <a href="http://msdn.microsoft.com/en-us/library/system.web.readentitybodymode.aspx">its enum type</a>.</p> <p>A <a href="http://aspnetwebstack.codeplex.com/SourceControl/changeset/0678d3e314c08403e1c9584cd08846b045ad5f5f">recent commit</a> to the ASP.NET WebAPI changed its method of reading the body entity to <code>GetBufferedInputStream()</code> where before it used <code>request.InputStream</code>.</p> <p>This appears to conflict with MVC's <code>JsonValueProviderFactory.GetDeserializedObject</code> which uses the "classic" <code>InputStream</code> property to read the entity body. If we take the error message at face value, <code>GetBufferedInputStream()</code> has already been called, but it isn't done reading when <code>InputStream</code> is accessed, so <code>InputStream</code> hasn't been filled yet.</p> <p>Need to do more testing, but a temporary fix (found by @KiranChalla) is to revert to a build from before the above-mentioned commit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload