Asp net core 2 2 brotli compression not working on iis


ASP.NET is a popular programming language used for building web applications. It provides a for developing dynamic websites, web services, and web APIs. One of the key features of ASP.NET is its ability to data to improve performance and reduce bandwidth . However, there have been reports of brotli compression not working on IIS when using ASP.NET Core 2.2. In this article, we will explore this and provide possible solutions.

Understanding Brotli Compression

Brotli is a compression algorithm by Google. It is designed to provide better compression ratios compared to other algorithms like Gzip. Brotli compression can significantly reduce the size of , resulting in faster load times and improved performance for web applications.

The Issue with Brotli Compression on IIS

Some developers have reported that brotli compression is not working on IIS when using ASP.NET Core 2.2. This means that even though the application is configured to use brotli compression, the compressed files are not being served to the . As a result, the performance benefits of brotli compression are not being realized.

Possible Solutions

There are a few possible solutions to this issue. Let's explore them one by one.

1. Check IIS Configuration

The first step is to ensure that IIS is properly configured to brotli compression. This can be done by checking the IIS configuration files and making sure that the necessary modules and settings are enabled. Here is an example of how to enable brotli compression in the web.config file:


Make sure to save the changes and IIS for the configuration to take effect.

2. Verify Brotli Support

Another possible solution is to verify that the server hosting the ASP.NET Core 2.2 application supports brotli compression. This can be done by checking the server's HTTP response headers. Look for the “Content-Encoding” header in the response and make sure it includes “br” for brotli compression. Here is an example of how to check the response headers using C#:

using System;
using System.Net.Http;

public class Program
    public static async Task Main(string[] args)
        using (var httpClient = new HttpClient())
            var response = await httpClient.GetAsync("");
            var contentEncoding = response.Content.Headers.ContentEncoding.FirstOrDefault();
            Console.WriteLine($"Content-Encoding: {contentEncoding}");

If the “Content-Encoding” header does not include “br”, it means that the server does not support brotli compression. In this case, you may need to consider using a different compression algorithm or upgrade the server to support brotli.

3. Update ASP.NET Core Version

If the above solutions do not work, it may be worth considering updating the ASP.NET Core version to a newer release. Microsoft regularly releases updates and bug fixes for ASP.NET Core, which may include improvements and fixes for brotli compression. Make sure to check the official documentation and release notes for any updates related to brotli compression.


Brotli compression is a powerful feature of ASP.NET that can significantly improve the performance of web applications. However, there have been reports of brotli compression not working on IIS when using ASP.NET Core 2.2. In this article, we explored possible solutions to this issue, including checking IIS configuration, verifying brotli support, and updating ASP.NET Core version. By following these , you should be able to resolve the issue and start benefiting from brotli compression in your ASP.NET Core 2.2 applications.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents