Iis-6

IIS6:為支持它的客戶端提供壓縮的靜態內容

  • September 10, 2010

如何將 IIS 配置為自動為支持它的客戶端提供壓縮的靜態資源(圖片、javascript、css 等),並為不支持壓縮的客戶端提供“正常”內容?

此外,IIS6 是否可以為我記憶體資源的壓縮版本,這樣我就不需要在每次請求時為壓縮而消耗 CPU 週期?

我需要為網站上的特定文件夾啟用此功能。

它可能不是 gzip,但這裡是 IIS 6 中 HTTP 壓縮的內幕:http: //www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d52ff289-94d3-4085-bc4e-24eb4f312e0e.mspx? mfr=真的

這是設置它的命令行選項:

ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE

ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcFileExtensions "asx" "css" "doc" "htm" "html" "js" "txt" "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDynamicCompressionLevel 9

ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcFileExtensions "asx" "css" "doc" "htm" "html" "js" "txt" "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp" "ashx" "asmx" "aspx" "axd" "dll" "exe" "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDynamicCompressionLevel 9

IIS 重置,清除記憶體,打開 Fiddler,打開 IE,發出請求,瞧,壓縮內容!需要注意的一件事是,每個請求都會發生動態級別的壓縮。部落格圈指出,動態壓縮的級別 9 和級別 10 之間的權衡是這樣的,您將需要考慮 9,因為它佔用的 CPU 與收益相比呈指數級減少。


這是我發現的在 IIS 6 上進行壓縮的最簡潔的方法,以上內容來自 Colin Bowern 在http://www.codinghorror.com/blog/2004/08/http-compression-and上的評論-iis-6-0.html

引用自:https://serverfault.com/questions/50217