|
This article refers to Windows Server 2003 which without a doubt offers the best platform for running ASP.NET available. Turning on the compression built into IIS6 allows you to save valuable bandwidth and improve load times of both static and dynamic ASP.NET content. IIS Compression in IIS6 - 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 the folder that you created above, 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
Note: The temporary compress directory is only used for static pages. Dynamic pages aren't saved to disk and are recreated every time so there is some CPU overhead used on every page request for dynamic content. Compressible Content If you are using Windows 2003 Server and enable compression in IIS6, you'll have compression enabled, but it will still be non-functional for ASP.NET! The reason for this is that the ASP.NET file extension (.aspx) is not set as a valid compressible file extension in the Metabase file. To edit the servers ‘Metabase’ find the \Windows\System32\inetsrv\MetaBase.xml and using your preferred text editor make the following changes. Under ‘IIsCompressionScheme’ there are two XML elements, one used for deflate and the other for gzip. Both elements have properties called ‘HcFileExtensions’ and ‘HcScriptFileExtensions’ which contain a space-delimited list of file extension for compressible content. You will need to add ‘aspx’ to the ‘HcScriptFileExtensions’ list and any other file type you wish to compress. Beware as certain media types do not compress as desired. Note: if the properties for ‘HcScriptFileExtensions’ are left blank, then all content, regardless of file extension, will be compressed. One further issue The following step is only required unless you find compression isn't working even after completing the ‘Metabase’ changes. - Open the IIS admin tool.
- Expand your server > right-click on "Web Service Extensions". Select "Add a new web service extension" (for the extension name, use whatever name desire as the identifier in the list)
- Add a single required file if missing (the ISAPI file responsible for ‘.gzip’ and deflate compression is \Windows\System32\inetsrv\gzip.dll)
- Make sure the "Set extension status to allowed" is checked
- Click OK.
You should now have a new web service extension of your selected name in the list with a status set to "Allowed". Testing Tools There are a number of testing tools available to monitor page load speeds and compression which will have to be the subject of another article!
|