exceptionless / Exceptionless.Net

Exceptionless clients for the .NET platform
https://exceptionless.com
Other
554 stars 142 forks source link

ExceptionlessMiddleware always "Unable to get POST data: The stream could not be reset." #217

Closed aabbcoder closed 4 years ago

aabbcoder commented 4 years ago

Version

Exceptionless.AspNetCore 4.3.4

Problem

RequestInfoCollector.cs

if (!context.Request.Body.CanSeek) {
    string message = "Unable to get POST data: The stream could not be reset.";
    log.Debug(message);
    return message;
}

long originalPosition = context.Request.Body.Position;
if (originalPosition > 0) {
    context.Request.Body.Position = 0;
}

Description

.net core Request.Body is stream of type FrameRequestStream and it doesn’t support seeking.

niemyjski commented 4 years ago

I. think you may need to enable buffering (https://devblogs.microsoft.com/aspnet/re-reading-asp-net-core-request-bodies-with-enablebuffering/). Can you try this and see if it works, We may need to update the readme and wiki for this (as there might be a performance overhead for enabling this).

aabbcoder commented 4 years ago

EnableBuffering, it works fine, thanks.