gRPC clients cannot read messages when using services.AddSystem.WebAdapters()
pockets3407 opened this issue · 6 comments
Summary
If it is possible, I would like to move middleware inside HttpContextStartupFilter into UseSystemWebAdapters(this IApplicationBuilder app).
Motivation and goals
- gRPC does not work when services.AddSystemWebAdapters() is used
- moving this to middleware will allow developers to branch middleware when the content type is gRPC
- grpc/grpc-dotnet#2340
Risks / unknowns
I'm not sure if the middleware order will be affected by this move.
I don't think developers will notice this change, app.UseSystemWebAdapters() should always be configured during startup. Perhaps, there is something I am missing, but documentation could also be updated to include this.
Examples
app.UseWhen(
context => context.Request.ContentType != "application/grpc",
builder =>
{
builder.UseSystemWebAdapters();
}
);
Which version are you using?
I ask, because the only thing done now in the pipeline outside of the app.UseSystemWebAdapters()
call is update a few feature implementations (that was a change in v1.3 - in 1.2, a number of other things were done as well that caused other problems similar to this).
@twsouthwick This issue occurs in both 1.3 and 1.2
Can you provide a working repro then to show this setup?
@twsouthwick Sure, here is the repo I have tested everything on. https://github.com/pockets3407/SystemWeb-Adapters-461
Found the issue - we were not flushing the PipeWriter which gRPC uses