IIS compression intermittent

Robert Crockett 21 Reputation points
2020-11-19T18:30:38.573+00:00

We have a conflict with our JavaScript minifier and IIS compression. The minifier recreates the file when the app pool resets and on other occasions. The zipped version of the file that was stored by IIS is occasionally not a complete file. We are assuming that the zipping is happening while the file is still being written. Our long term plan is to minify the file at build time.

In the meantime we have compression turned off for that particular folder to avoid the conflict, but sometimes we still get the compressed version of the file, and occasionally we see the badly compressed file sent to our users.

Questions:

Does IIS zip files to its temp folder even when compression is turned off?

We turned off Dynamic Compression through the IIS Manager. We are using IIS 10. We turned of Dynamic Compression since that appeared to be what stopped compression when we tried it in browsers. We did not turn off static compression.

We have determined that this is not a caching issue on the client. We see the undersized files being sent in the IIS log.

Is there a need to turn off static compression too?

Would turning off compression via the site’s web.config make a difference?

Are there any additional settings that might explain why IIS is still sending the compressed file some of the time?

Is this a known problem? If so is there a work around? Is there a scheduled fix?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,344 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,516 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce Zhang-MSFT 3,736 Reputation points
    2020-11-20T09:51:10.377+00:00

    Hi @Robert Crockett ,

    About your question.

    • Zip files will not store to temp folder when compression is turned off. Compression happens on the main thread. But to not incur cost of compression for all requests compression happens only for frequently requested content. Only when compression is enabled and the client receives compressed headers in the request, IIS will compress the resource and update it to the temp folder, and respond to the client. Otherwise, IIS always responds to the client with the original resource.
    • Whether the compressed file will be sent to the client in response depends not only on whether it is enabled in IIS, but also on whether there is Accept-Encoding: gzip or Accept-Encoding: deflate in the headers.
    • Whether to use compression depends on the amount of traffic in a request of site itself. The main function of compression is to save bandwidth and traffic. If you have a large number of static files in your site and a large number of files need to be loaded to the client for each request, I recommend that you enable static compression.
    • Setting compression through web.config and IIS Manager has the same effect. IIS Manager essentially modifies the content of web.config, but it is faster and more convenient than modification in web.config.
    • IIS can also compress javascript files. You can use IIS to compress all resources. Using multiple minifiers at the same time may cause unforeseen problems.

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    BruceZhang


0 additional answers

Sort by: Most helpful