我正在尝试在我的网络服务器上启用gzip压缩。我在服务器上安装了动态压缩模块,并在IIS中启用了它。现在我试图指定dynamicTypes以包含application/json
。我按照these步骤进行了操作。我成功地在服务器级别添加了动态类型。当我检查我的应用程序时,我注意到响应标头仍然没有包含gzip。然后我回到IIS确认服务器上的配置编辑器设置是为我的站点继承的。在站点级别,我在system.webServer部分下拉列表中看不到httpCompression
节点。 IIS10的同事(我有IIS8)能够看到system.webServer/httpCompression
节点。
知道为什么我没有看到那个节点吗?我相信这是导致gzip无法在我的设置中工作的原因。
答案 0 :(得分:0)
奇怪的是你没有看到它。尝试重新安装压缩模块(动态和静态)。除此之外,请确保您位于 system.webServer
下面<urlCompression doDynamicCompression="true" doStaticCompression="true" />
答案 1 :(得分:0)
I just figured out what the problem was. First, there seems to be a difference between versions of IIS (IIS6 and IIS10 in my case) in that some (newer) versions have an system.webServer/httpCompression
on the site, not just the server. I thought that was the reason dynamic caching seemed to not work on our dev server but did work on a colleague's machine with IIS10.
It turns out the reason I wasn't seeing a gzip encoding reference in the response headers is because of IE, IE10 to be exact. Our dev environment currently has a certificate problem and you can only open the app in IE. I have IE10 and it does not appear to display any information on the response headers about compressed encoding. I had my colleague with IE11 hit our app in the dev environment and he sees the gzip encoding reference in the response headers.
This is why I hate IE...