Click here to Skip to main content
13,597,797 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 17 May 2010
Licenced CPOL

Enable Http Compression

, 18 May 2010
Rate this:
Please Sign up or sign in to vote.
A set of command line operations to enable and configure compression in IIS.
You can use compression in IIS to improve the response of your web site.

There are two implemented methods for compression:

    • Deflate

    • GZIP

Navigate to the AdminScripts directory in a command prompt window with administrative privileges. The default script host is wscript. For the purpose of this tip, switch to cscript with the following command

cscript.exe /h:cscript

The following commands will change various compression settings for IIS.

cscript.exe adsutil.vbs set W3svc/Filters/Compression/{GZIP|DEFLATE}/
{HcFileExtensions "StaticFileType" ...}|{HcScriptFileExtensions "DynamicFileType" ...}

Configure static compression

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "js" "txt"

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "js" "txt"

Configure dynamic file compression

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "asmx" "aspx"
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "asmx" "aspx"

Set the compression level

CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel "9"
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel "9"

Global compression settings

cscript.exe C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/root/DoStaticCompression False
cscript.exe C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/root/DoDynamicCompression False


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Tripathi Swati
Software Developer (Senior) RadixWeb India
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralIIS 7 Performance Section Pin
TheyCallMeMrJames18-May-10 3:47
memberTheyCallMeMrJames18-May-10 3:47 
GeneralRe: IIS 7 Performance Section Pin
Tripathi Swati18-May-10 22:30
memberTripathi Swati18-May-10 22:30 
GeneralRe: IIS 7 Performance Section Pin
TheyCallMeMrJames19-May-10 3:01
memberTheyCallMeMrJames19-May-10 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02-2016 | 2.8.180621.3 | Last Updated 18 May 2010
Article Copyright 2010 by Tripathi Swati
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid