5

Ok, I've been reading for hours about this. Dozens of SO posts and blogs, etc. No answer to be found.

Goal: enable dynamic http compression of json response from my WCF service.

Note: gzip already works for static content and for dynamic content when applicationhost.config contains the following:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/json; charset=utf-8" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>    
</httpCompression>
</system.webServer>

Unfortunately on the server I'm using the following line is missing from applicationhost.config:

<add mimeType="application/json; charset=utf-8" enabled="true" />

And I cannot add it manually because the server is an AWS EC2 instance launched by Elastic Beanstalk (as such I could change it on one instance but not on all instances whenever they are launched).

Also unfortunately, the applicationhost.config includes this line:

<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />

Which means that I cannot override the httpCompression section in my app's web.config.

My question: are there other approaches to enabling gzip compression of dynamic content that I should try?

If overrideModeDefault="Allow" would I then be able to place the httpCompression section in my app's web.config and expect it to override?

Happy to add further clarification if needed.

Cheers

4

1 に答える 1