Page 1 of 1 in the IIS7 category
# Monday, September 29, 2008
Monday, September 29, 2008 7:19:46 AM UTC
« [Previous Post] Being My Wife Life as of 2008-09-29 [Next Post] »

Tonight I set about trying to get my IIS7 server to serve files with the application/x-javascript content type as compressed. After a bunch of testing, back and forth, ultimately this is what worked for me in my applicationHost.config file:

<dynamicTypes>  
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript; charset=utf-8" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
</dynamicTypes>

You have to be specific it seems, specifying the charset. And it needs to go before the regular x-javascript entry. Go figure. Hopefully this saves someone else some headaches.

Also, while you’re tinkering with applicationHost.config, you might as well change this:

<serverRuntime />

Into this:

<serverRuntime frequentHitThreshold="1" />

That specifies that IIS7 should compress/cache any static content the first time it’s requested. Otherwise, it defaults to “2”, which means it will only cache the compressed content if it’s requested at least 2 times within 10 minutes.

 
Page 1 of 1 in the IIS7 category