IIS 7.5 Static Content Compression (not consistent )

后端 未结 1 1680
-上瘾入骨i
-上瘾入骨i 2021-01-05 02:51

I have the following web.config:


        
            
              


        
1条回答
  •  离开以前
    2021-01-05 03:49

    After a lot of searching, I finally found what got compression working more consistently on my IIS 7.5. To start with, IIS will not compress a file unless it loaded often enough. That brings up the question "what does IIS consider often enough?" Well, the defaults are 2 times every 10 seconds. Yikes!

    This setting can be changed in web.config, but the section needs to be unlocked first in applicationHost.config. Here are the commands:

    First unlock the section:

    C:\Windows\System32\inetsrv\appcmd.exe unlock config /section:system.webServer/serverRuntime

    Unlocked section "system.webServer/serverRuntime" at configuration path "MACHINE/WEBROOT/APPHOST".

    Now that is done, edit the web.config file

     
        
            
            ...
    

    In this case, I set it to hit the file once in a 10 hour period. You can adjust the values as necessary. Here is the document that explains the serverRuntime element:

    http://www.iis.net/configreference/system.webserver/serverruntime

    I hope this helps get your compression working properly.

    0 讨论(0)
提交回复
热议问题