Faced a similar issue with my C# code in VS2022. Fixed it by commenting out this line in Development Environment:
app.UseResponseCompression();