Search
Close this search box.

HOW TO Enable ClickOnce Compression on IIS

ClickOnce supports using HTTP compression for the file downloads, a Web server technology that uses the GZIP algorithm to compress a data stream before sending it to the client. The client—in this case, ClickOnce—decompresses the stream before reading the files. This results in shorter download times for your ClickOnce deployments.

If you are using Internet Information Services (IIS), you can enable HTTP compression easily.

Enable Compression in IIS

  • From the IIS snap-in, right-click on the Web Sites node and click on Properties
  • Select the Service tab – Enable Compress application files
  • Enable Compress static files
  • Change Temporary Directory to a folder that you created (the IUSR_{machinename} will need write permission to the folder), or leave it at it’s default
  • Set the max size of the temp folder to something that the hard drive can handle. i.e. 1000.
  • Save and close the Web Site Properties dialog

However, this only activates it for certain file types—namely, HTML and text files. In order to activate compression for assemblies (.dll), XML (.xml), deployment manifests (.deploy) and application manifests (.manifest), you must add these file types to IIS’s list of types to compress. Until you do this, none of the files in your deployment except text and HTML files will be compressed.

To add the document types for ClickOnce deployment files (.application, .manifest, .deploy, .dll, .exe, etc.), follow these steps:

NOTE: The commands in step 3 replace the previously defined file extensions. It does not append them to the existing file extensions.

1. Open a command prompt session. To do this, click Start, click Run, type CMD, and the click OK.
2. Change the directory to your \InetPub\AdminScripts folder. To do this, type CD \Inetpub\AdminScripts, and then press ENTER.
3. Type the following commands:

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "application" "manifest" "deploy" "exe" "dll"

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "txt" "application" "manifest" "deploy" "exe" "dll"

IISRESET.EXE  (this will reset Web services)

In case you also want to enable compression for ASP.NET Web pages and Web services, drop in these (extra) two lines before the IISRESET:

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"

Testing

To test the web server is compressing you can do two things:

1. Check the “…WINDOWS\IIS Temporary Compressed Files” folder on the server and see if new files are added as you go through the ClickOnce installation process.

2. Use netcat (yes, yes, from the old days of hackerish “security tools”, nothing beats netcat yet) to manually send an HTTP request to the server and see if the HTTP response contains the header “Content-Encoding: gzip”

A sample HTTP request header you would send is:

GET / clientes / ventas / Ventas_1_0_0_8 / Ventas.exe.deploy HTTP /
    1.1 Accept : */*
Accept-Language: es-ar
Accept-Encoding: gzip, deflate
Host: youhost.yourdomain.com
Connection: Keep-Alive

where the “replaceable parameters” are “youhost.yourdomain.com” for your webserver HOST, and “/clientes/ventas/Ventas_1_0_0_8/Ventas.exe.deploy” for the URL path to your application’s exe .deploy file

Sources

IIS Compression in IIS6.0
http://www.wwwcoder.com/main/parentid/170/site/3669/68/default.aspx

HOW TO: Enable ASPX Compression in IIS
http://support.microsoft.com/default.aspx?scid=kb;en-us;322603

Troubleshooting ClickOnce Deployments
http://msdn2.microsoft.com/library/fb94w1t5(en-us,vs.80).aspx

posted on Wednesday, November 30, 2005 7:11 AM

This article is part of the GWB Archives. Original Author: Juan Ignacio Gelos

Related Posts