Skip to content

${aspnet-request-posted-body}: Use Async reading to prevent "Synchronous operations are disallowed"#549

Merged
304NotModified merged 3 commits intomasterfrom
body-async
May 13, 2020
Merged

${aspnet-request-posted-body}: Use Async reading to prevent "Synchronous operations are disallowed"#549
304NotModified merged 3 commits intomasterfrom
body-async

Conversation

@304NotModified
Copy link
Member

@304NotModified 304NotModified commented Apr 19, 2020

needs a good (real-life) test

fixes #548

@304NotModified 304NotModified marked this pull request as draft April 20, 2020 09:59
@304NotModified 304NotModified changed the base branch from dev to master April 20, 2020 10:05
@304NotModified
Copy link
Member Author

Update the demo and confirm it works now:

image

@304NotModified 304NotModified marked this pull request as ready for review May 11, 2020 19:39
@304NotModified 304NotModified changed the title ${aspnet-request-posted-body}: Use Async reading for .NET standard (WIP) ${aspnet-request-posted-body}: Use Async reading for .NET standard May 11, 2020
@304NotModified 304NotModified changed the title ${aspnet-request-posted-body}: Use Async reading for .NET standard ${aspnet-request-posted-body}: Use Async reading for .NET standard platforms to prevent "Synchronous operations are disallowed" May 11, 2020
@304NotModified 304NotModified changed the title ${aspnet-request-posted-body}: Use Async reading for .NET standard platforms to prevent "Synchronous operations are disallowed" ${aspnet-request-posted-body}: Use Async reading for ASP.NET Core to prevent "Synchronous operations are disallowed" May 11, 2020
@304NotModified 304NotModified changed the title ${aspnet-request-posted-body}: Use Async reading for ASP.NET Core to prevent "Synchronous operations are disallowed" ${aspnet-request-posted-body}: Use Async reading to prevent "Synchronous operations are disallowed" May 11, 2020
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@snakefoot
Copy link
Contributor

Thanks to @bakgerman now NLog.Web.AspNetCore v5.1 re-introduces ${aspnet-request-posted-body} with help from middleware:

app.UseMiddleware<NLog.Web.NLogRequestPostedBodyMiddleware>();

It is no longer necessary to explicit call context.Request.EnableBuffering(); as it is handled by the middleware.

@snakefoot snakefoot added ASP.NET Core ASP.NET Core - all versions and removed ASP.NET Core 1 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASP.NET Core ASP.NET Core - all versions bug size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

${aspnet-request-posted-body} could throw 'Synchronous operations are disallowed' for ASP.NET Core 3

2 participants