iis7 compress dynamic content from custom handler

Posted by Malloc on Stack Overflow See other posts from Stack Overflow or by Malloc
Published on 2010-03-25T21:39:37Z Indexed on 2010/03/25 21:43 UTC
Read the original article Hit count: 512

Filed under:
|
|
|

I am having trouble getting dynamic content coming from a custom handler to be compressed by IIS 7.

Our handler spits out json data (Content-Type: application/json; charset=utf-8) and responds to url that looks like: domain.com/example.mal/OperationName?Param1=Val1&Param2=Val2

In IIS 6, all we had to do was put the edit the MetaBase.xml and in the IIsCompressionScheme element make sure that the HcScriptFileExtensions attribute had the custom extension 'mal' included in it.

Static and Dynamic compression is turned out at the server and website level. I can confirm that normal .aspx pages are compressed correctly. The only content I cannot have compressed is the content coming from the custom handler.

I have tried the following configs with no success:

<handlers>
  <add name="MyJsonService" verb="GET,POST" path="*.mal" type="Library.Web.HttpHandlers.MyJsonServiceHandlerFactory, Library.Web" />
</handlers>

<httpCompression>
  <dynamicTypes>
    <add mimeType="application/json" enabled="true" />
  </dynamicTypes>
</httpCompression>

_

<httpCompression>
  <dynamicTypes>
    <add mimeType="application/*" enabled="true" />
  </dynamicTypes>
</httpCompression>

_

<staticContent>
  <mimeMap fileExtension=".mal" mimeType="application/json" />
</staticContent>
<httpCompression>
  <dynamicTypes>
    <add mimeType="application/*" enabled="true" />
  </dynamicTypes>
</httpCompression>

Thanks in advance for the help.

© Stack Overflow or respective owner

Related posts about iis7

Related posts about compression