I just got done reviewing some sites for a client and found that gzip compression was not working although it had very explicitly been configured. The servers were running IIS 6.0 (Windows 2003) and the compression had been enabled through a standard script. The problem was that the script was setting the extensions to be compressed using spaces as delimiters, but the metabase expects this parameter’s values to be CR/LF delimited. It took me a while to figure out how to add CR/LF when setting a parameter using adsutil.vbs from the command line, so I’m posting the final updated script here in case it helps anyone else.
@echo off
setlocal
set ADMINSCRIPTS=C:\Inetpub\AdminScripts
echo This will enable compression for all sites on this server.
echo If you wish to continue, hit enter. Otherwise, press CTRL+C to abort.
pause
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/deflate/HcFileExtensions "asp" "aspx" "axd" "ashx" "htm" "html" "txt" "css" "js" "xml"
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/deflate/HcScriptFileExtensions "asp" "aspx" "axd" "ashx" "htm" "html" "txt" "css" "js" "xml"
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/deflate/HcDynamicCompressionLevel 4
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/gzip/HcFileExtensions "asp" "aspx" "axd" "ashx" "htm" "html" "txt" "css" "js" "xml"
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/gzip/HcScriptFileExtensions "asp" "aspx" "axd" "ashx" "htm" "html" "txt" "css" "js" "xml"
cscript %ADMINSCRIPTS%\adsutil.vbs set w3svc/filters/compression/gzip/HcDynamicCompressionLevel 4
echo.
echo Confirming static deflate file extensions...
cscript %ADMINSCRIPTS%\adsutil.vbs get w3svc/filters/compression/deflate/HcFileExtensions
pause
echo.
echo Confirming dynamic deflate file extensions...
cscript %ADMINSCRIPTS%\adsutil.vbs get w3svc/filters/compression/deflate/HcScriptFileExtensions
pause
echo.
echo Confirming static gzip file extensions...
cscript %ADMINSCRIPTS%\adsutil.vbs get w3svc/filters/compression/gzip/HcFileExtensions
pause
echo.
echo Confirming dynamic gzip file extensions...
cscript %ADMINSCRIPTS%\adsutil.vbs get w3svc/filters/compression/gzip/HcScriptFileExtensions
pause
echo.
echo IIS needs to be restarted for the changes to take effect.
echo To let this script restart IIS for you, press enter.
echo Otherwise, press CTRL+C and restart it manually later.
pause
iisreset
Advertisement
Like this:
Be the first to like this post.
leave a comment