I just went through the process of enabling HTTP Compression for 2 ASP.NET applications running under Windows Server 2003 and IIS 6, so I thought I’d share a summary of the process.
Huge thanks to Robert Boedigheimer for his assistance with this process. I attended his excellent Things Every ASP.NET Developer Should Know session at devLINK last month and then he helped me work through the particulars.
Robert also explained to me how to determine if my site (internal) is using HTTP Compression.
- Start Microsoft’s Network Monitor.
- Open a “New Capture Tab”
- On the toolbar click “Start” to start a trace.
- Using any browser, browse to a web page for the site in question.
- In Network Monitor, click “Stop” in the toolbar.
- In the “Display Filter” panel, type “http” (no quotes) and Apply.
- Find the Response frame in the middle panel. Select that frame, then examine the Hex Details frame.
- To the far right in the Hex Details frame, you should see that Content-Encoding is gzip.
Other good references:
- Scott Forsyth’s blog
- Microsoft TechNet Enabling HTTP Compression
- TotalDevPro’s Enabling HTTP Compression in IIS 6.0
I created a batch file that will perform the entire HTTP Configuration process. Here are the overall steps:
- Stop IIS.
- Backup the MetaBase
- Create the temporary folder to contain the compressed files, and set the max folder size
- Update the MetaBase with the new settings
- Restart IIS.
1: @ECHO OFF2: iisreset /stop /noforce3: MKDIR "E:\IIS Temporary Compressed Files"4: cscript.exe iisback.vbs /backup /b BeforeHttpCompressionChange5: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE6: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE7: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE8: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcNoCompressionForHttp10 TRUE9: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcNoCompressionForProxies FALSE10: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcNoCompressionForRange FALSE11: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcCompressionDirectory "E:\IIS Temporary Compressed Files"12: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcMaxDiskSpaceUsage "52428800"13: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoDiskSpaceLimiting TRUE14: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcDoStaticCompression TRUE15: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcDoOnDemandCompression TRUE16: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcDoDynamicCompression TRUE17: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcFileExtensions "css" "doc" "htm" "html" "js" "txt" "xml"18: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"19: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcOnDemandCompLevel 920: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/deflate/HcDynamicCompressionLevel 921: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcDoStaticCompression TRUE22: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcDoOnDemandCompression TRUE23: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcDoDynamicCompression TRUE24: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcFileExtensions "css" "doc" "htm" "html" "js" "txt" "xml"25: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"26: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcOnDemandCompLevel 927: cscript.exe adsutil.vbs Set W3SVC/Filters/Compression/gzip/HcDynamicCompressionLevel 928: iisreset /start29: PAUSE
No comments:
Post a Comment