IIS Static Compression caching truncated files

New Contributor

OS: Windows Server 2016

IIS: 10.0.14393.0


We serve a 1.5MB CSS file from our main website. With static compression enabled, it delivers a ~220kb file to the client from the IIS compression cache. However, we've now had several instances where the cached version of the file is truncated. Since it is the main CSS for the page, the layout is distorted, and the site becomes unusable.


I was able to partially reproduce the issue by forcing a slow upload over FTP. Since the FTP server doesn't lock the file during upload, IIS serves a partial file if it reaches the cache threshold (the default 2 loads in 10 seconds in our case), during the copy. This is expected - IIS doesn't know the file upload is in progress, and it isn't locked, so it serves the partial file. However, it seems that periodically, IIS doesn't notice that the cached version differs from the source file, and it continues to serve the truncated file from the compression cache after the file is fully uploaded. I haven't been able to reproduce the conditions that cause this specifically - during testing, IIS detects the difference and re-caches the compressed version of the full file. But a partial file has been left in the cache multiple times on our production servers within the last 2-3 months.


For now, we're fixing this my automating deletion of the cached copy when it is detected as being too small, but we'd be interested in a more permanent fix. Our process has not changed recently - no new software installed on the web servers other than Windows updates. Has anyone else encountered this?

2 Replies

@chapbak Did you try rebooting the server?  I usually find rebooting 3x fixes the issue.

Hi @chapbak,

Thanks for posting your issue here.

However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang