title: Reading Request body in .net core 3.1
body: <p>I am trying to read request body in ActionFilter but having some strange errors.</p>
  <p>What I tried so far:</p>
  <ol>
  <li>Copying request body to memory stream</li>
  </ol>
  <pre><code>context.HttpContext.Request.Body.CopyTo(memoryStream) 
  </code></pre>
  <p>Throws an error that only async operations are supported.</p>
  <ol start="2">
  <li>Copying request body to memory stream async</li>
  </ol>
  <pre><code>context.HttpContext.Request.Body.CopyToAsync(memoryStream).Wait()
  </code></pre>
  <p>Copies 0 bytes</p>
  <ol start="3">
  <li>Using BodyReader:</li>
  </ol>
  <pre><code>context.HttpContext.Request.BodyReader.AsStream(true).CopyToAsync(requestBody).Wait();
  </code></pre>
  <p>throws ArgumentOutOfRange exception 'Specified argument was out of the range of valid values. (Parameter 'start')'</p>
  <p>I am using .net core 3.1</p>