Aspnetcore.docs: Now UseMvc is not recommended - where does UseResponseCompression fit in?

Created on 22 Jan 2020  Â·  3Comments  Â·  Source: dotnet/AspNetCore.Docs

Thanks for your amazing docs 🤗

I have a question: now that the following UseMvc is effectively deprecated with .NET Core 3+ ( see https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-core-3-0-preview-4/. ), should this piece of advice be updated:

> app.UseResponseCompression must be called before app.UseMvc

And if so, in what way? I'm asking as I've just noticed that UseResponseCompression doesn't seem to be working on my .NET Core 3.1 app


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P1 Source - Docs.ms doc-bug

All 3 comments

Good :eye: @johnnyreilly ... I'll fix that up. The advice is the same: Use the compression middleware before any other middleware that you'd like compressed responses from. Generally, place it early in the pipeline. See the very last paragraph and example at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-3.1#middleware-order.

Awesome - thanks! It's not working on my machine but at least I'm doing the correct thing. Will have to investigate!

Yeah ... happens quite a bit. Make sure you follow https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-3.1#troubleshooting ... especially the part about using a tool to test and not a browser.

Was this page helpful?
0 / 5 - 0 ratings