title: Unable to enable gzip compression for XHR responses in Azure Web Role
body: <p>Strangely I read tons of posts regarding the exact problem and many resolutions with it, but couldn't figure this out. So please read the following just to clarify what my problem is and what I have done so far to resolve the issue.</p>
  
  <p><strong>Problem</strong> : Unable to use dynamic compression for the xhr responses from my webservice hosted in an azure web role (instance has IIS 7.0), although javascript files (using mime type text/javascript) and aspx pages are properly loaded with gzip compression.</p>
  
  <p><strong>Environment</strong> : A medium azure instance running IIS 7.0</p>
  
  <p><strong>What I have tried and verified to resolve the issue</strong> </p>
  
  <ul>
  <li>Make sure Azure CDN is disabled ( enabling azure cdn will disallow compression for xhr and this has to be resolved using different means. For instance by writing a custom web resource handler as explained here <a href="https://stackoverflow.com/questions/10420004/azure-cdn-enabling-http-compression-hosted-web-role/10434390#10434390">Azure CDN - Enabling HTTP Compression - Hosted Web Role</a> ) (Done)</li>
  <li>Make sure that the right applicationHost.config file is being targeted for editing if you're doing it manually. For instance on an IIS 7.0 running on 64-bit your applicationHost.config file would be located at %windir%\SYSWOW64\inetsrv\config and not in %windir%\System32\inetsrv\config folders. (Done)</li>
  <li>Make sure dynamic compresion is enabled at IIS Server level and website level via IIS 7.0 (Done)</li>
  <li>Verify that the applicationhost.config also has dynamic compression enabled. (Done)</li>
  <li>Verify that appropriate mime types are used for compression. (Done) I have used the following mime types.
  
  <ul>
  <li>add mimeType="application/json" enabled="true" </li>
  <li>add mimeType="application/json; charset=utf-8" enabled="true"</li>
  </ul></li>
  <li>Verify that the size of the response meets the set threshold of the size of data that requires compression. (Done)</li>
  <li>Recycle the application pool once the applicationhost.config file is edited for changes to httpCompression to take effect. (Done)</li>
  <li>Verify that there's enough space on the directory where temporary files are created for compression. (Space available)</li>
  <li>Verify that failed request logs do not show disabled compression errors. (No failed requests logged).</li>
  </ul>
  
  <p>I guess the above ought to cover what I have tried and tested so far. Most people seem to have had issues related to the mime type but mine doesn't seem to be it. </p>
  
  <p>Any suggestions or procedures that might help me sort this issue are welcome.</p>
  
  <p><strong>UPDATE</strong> : Added new step for verification. Please refer to step number 02 (Edited on 07/19/2012)</p>