This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.

See original GitHub issue

Describe the bug I use .NET Framework. I get this error:

This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.

This error occurs when I include request body

To Reproduce Only initial setup:

config.Filters.Add(new AuditApiGlobalFilter(cfg => cfg .LogAllActions() .WithEventType(x => x.Request.RequestUri.PathAndQuery) .IncludeHeaders() .IncludeRequestBody() .IncludeResponseBody()));

Expected behavior Audit.NET should be able to read the request body

Libraries (specify the Audit.NET extensions being used including version): For example:

  • Audit.WebApi: 14.3.3

Additional context at System.Web.HttpRequest.get_InputStream() ↵ at Audit.WebApi.AuditApiAdapter.GetRequestBody(IContextWrapper contextWrapper) ↵ at Audit.WebApi.AuditApiAdapter.<BeforeExecutingAsync>d__1.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Runtime.CompilerServices.TaskAwaiter.GetResult() ↵ at Audit.WebApi.AuditApiGlobalFilter.<OnActionExecutingAsync>d__19.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
MfsiSumitscommented, Apr 23, 2021

I will investigate the issue and let you know.

Anyway, thanks for help and effort to build this library. It is amazing.

What was the solution? I am also facing the same issue

Thanks, Sumit

1reaction
danilovuloviccommented, May 11, 2019

I will investigate the issue and let you know.

Anyway, thanks for help and effort to build this library. It is amazing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

This method or property is not supported after HttpRequest. ...
In web API, I am getting following error "This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked."
Read more >
File upload Request.Files throws an error - Progress Community
InputStream property throws exception “This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.
Read more >
[Solved]-This method is not supported after HttpRequest ...
Coding example for the question This method is not supported after HttpRequest.GetBufferlessInputStream has been invoked-C#.
Read more >
How should I use HttpRequest.GetBufferlessInputStream
If I try to use the InputStream, I get an exception. "This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked"....
Read more >
Error in C# APS.NET web project with both MVC and WebApi
In this case the request fails with a "This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found