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

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()

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

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

I will investigate the issue and let you know.

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

No, webhost. I will try owin for project from scratch

Thanks for super fast response.

I saw it, but I do not use .net core and there is no Rewind