IIS, Non-functional Requirements, Performance

Compress your static and dynamic content in IIS and improve the performance of your website.

A quick way to give your site a performance boost is to enable compression of your content, so a smaller payload is sent over the wire to the browser. I’ve seen this described in a complex way and I think it’s really quite easy.

First – check that the server roles of “Static Content Compression” and “Dynamic Content Compression” are available in your version of IIS.

By default, Static is available but Dynamic is not. If you’re on Windows Server, you need to add this role through Server Manager. If you’re on a standard Windows install, you can do this through turning Windows features on or off through the Programs app in Control Panel.

Second – You need to modify your web.config file. Find the <system.webServer> node, and add the line:

<urlCompression doStaticCompression="true" doDynamicCompression="true" />

Note that both attribute values are set to true.

Third – Restart your server (this bit’s necessary if you installed the Dynamic Content Compression role in step 1).

And refresh your web page. It’s really that simple.

You can test that your site is using GZIP by using the Web Developer Toolbar in Chrome or Firefox – go to Information -> View Response Headers, and look for a header with the text below:

Content-Encoding: gzip

Lots more detailed information here: https://www.iis.net/configreference/system.webserver/urlcompression