httpCompression not work inside web.config

2019-07-15 01:56发布

问题:

Is their anyway to make httpCompression work from inside web.config ?

i try to add this in my web.config but it's does nothing :

<httpCompression>
  <dynamicTypes>
    <clear />
    <add mimeType="text/*" enabled="true" />
    <add mimeType="application/json" enabled="true" />    
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <clear />
    <add mimeType="text/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression> 

回答1:

Overriding compression related settings in web.config is considered a new addition in IIS 10,

https://blogs.msdn.microsoft.com/friis/2017/09/05/iis-dynamic-compression-and-new-dynamic-compression-features-in-iis-10/

So to answer your question, you have to upgrade to IIS 10.