On Windows Azure, static compression is enabled by default. However, you would have to enable dynamic compression for your application.
This can be done by adding the following entry in the Application’s web.config @
<urlCompression doDynamicCompression="true" doStaticCompression="true" />
This change is sufficient for web services and web applications. However, if your application returns a mime type that is not included in the default compression list, you would have to add these mime types using
Enabling HTTP Compression
- Update the service definition file to contain this in the WebRole/WorkerRole tag
<Startup> <Task commandLine="iisconfigchanges.cmd" executionContext="elevated" taskType="simple"></Task> </Startup>
- In your web-role, a cmd file (e.g. iisconfigchanges.cmd) with required commands to customize ApplicationHost.config configuration of IIS.
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost
- If you need to compress any specific files other than mentioned above, find out the MIME types per your requirement and add similar commands to the file. Just make sure using Fiddler that you type the exact mime type returned by your application.
- IIS 7 Compression. Good? Bad? How much?
- Enable static compression in Azure (CSAzureEnableCompression)
- How to enable gzip HTTP compression on Windows Azure dynamic content