Static compression in IIS does not work for htm, js files

前端 未结 3 1281
不思量自难忘°
不思量自难忘° 2021-01-18 10:40

I\'m trying to configure IIS 7.5 to compress static htm and js files. Does anyone know why it does not work for me? Here is my web.config for the web site:

          


        
3条回答
  •  我在风中等你
    2021-01-18 11:34

    I removed the mimeType="application/x-javascript" from the dynamicTypes but left it in staticTypes. That allowed me to turn off dynamicCompression but still have javascript compressed.

    I've read some posts that suggest that when you have the same mimeType in both dynamic and static, the value in dynamic wins. When dynamicCompression is off, but there is a match for it in the dynamicTypes, javascript is treated as dynamic and therefore off.

    That doesn't explain why CSS works because mimeType="text/" is in both places. IIS must do a better job of determining dynamic vs. static content when it comes to CSS, or any text/.

提交回复
热议问题