I did this in my project recently.Please find the list of commands we used to turn compression on axd on.
1.In IIS Manager,Right-click on "Web Service Extensions" and add a new Web Service. Name it something like "HTTPCompression" and add the file "C:\WINDOWS\system32\inetsrv\gzip.dll". Check the "Set extension status to Allowed". Press "OK".
2.Then right-click on your server (local computer) and goto Properties. Check the "Enable Direct Metabase Edit". Press "OK".
3.Copy the below commands in BAT file and run the bat file.
@ECHO OFF
ECHO.
IF "%1"=="" GOTO ERROR1
ECHO BACKING UP THE METABASE FILE
IF EXIST C:\Inetpub\AdminScripts\adsutil.vbs (SET ADSFILE=C:\Inetpub\AdminScripts\adsutil.vbs)
IF EXIST D:\Inetpub\AdminScripts\adsutil.vbs (SET ADSFILE=D:\Inetpub\AdminScripts\adsutil.vbs)
ECHO ADS FILE LOCATION IS %ADSFILE%
IF "%ADSFILE%" == "" GOTO ERROR2
copy c:\winnt\system32\inetsrv\Metabase.xml %1
ECHO Adding settings for IIS6 HTTP Compression ECHO.
cscript %ADSFILE% set /w3svc/filters/compression/deflate/HcFileExtensions "css" "htc" "htm" "html" "txt" "js"
cscript %ADSFILE% set /w3svc/filters/compression/deflate/HcDynamicCompressionLevel "8"
cscript %ADSFILE% set /w3svc/filters/compression/deflate/HcOnDemandCompLevel "10"
cscript %ADSFILE% set /w3svc/filters/compression/deflate/HcScriptFileExtensions "asp" "exe" "aspx" "pser" "axd"
cscript %ADSFILE% set /w3svc/filters/compression/deflate/HcDoStaticCompression "FALSE"
cscript %ADSFILE% set /w3svc/filters/compression/gzip/HcFileExtensions "css" "htc" "htm" "html" "txt" "js"
cscript %ADSFILE% set /w3svc/filters/compression/gzip/HcDynamicCompressionLevel "8"
cscript %ADSFILE% set /w3svc/filters/compression/gzip/HcDoStaticCompression "TRUE"
cscript %ADSFILE% set /w3svc/filters/compression/gzip/HcOnDemandCompLevel "10"
cscript %ADSFILE% set /w3svc/filters/compression/gzip/HcScriptFileExtensions "asp" "exe" "aspx" "pser" "axd"
ECHO.
ECHO.
ECHO Changes completed. Do an iisreset for changes to have effect!
ECHO.
PAUSE
goto EXITERROR
:ERROR1
ECHO PLEASE PROVIDE BACKUP LOCATION.
goto EXITERROR
:ERROR2
ECHO ADSUTIL.VBS LOCATION IS NOT IDENTIFIED.PLEASE CONTACT CITI SME.
:EXITERROR
4. Restart the IIS