在IIS 8和Windows 8中设置gzip [英] Set up gzip in IIS 8 and Windows 8

查看:67
本文介绍了在IIS 8和Windows 8中设置gzip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了默认的MCV4网站,并将其托管在默认网站下的widows 8系统中的本地IIS8中.

I created the default MCV4 website and hosted in my local IIS8 in widows 8 system under default web site.

http://localhost/MyWesite

IIS管理器中的

压缩"启用了动态内容压缩和静态内容压缩.还禁用了压缩文件大小限制,因此所有js文件大小都被考虑进行压缩(仍然没有进行gzip压缩)

in IIS manager "Compression" enabled dynamic content compression and static content compression. also disabled file size limit for compression so all js file sized are considered for compression (still gzip compression did not happen)

这是唯一的系统级gzip配置吗?

Is this the only system level gzip configuration?

然后接下来,我尝试进行网站级别更改.我还编辑了C:\ Windows \ System32 \ inetsrv \ config中的applicationHost.config文件,以下是我所做的更改

Then next I tried to do website level change. I also edited the applicationHost.config file in C:\Windows\System32\inetsrv\config below are the change I did

<section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />

在web.config文件中,我添加了以下

in the web.config file I added the following

<system.webServer>
<httpCompression> 
  <staticTypes> 
    <add mimeType="text/*" enabled="true" /> 
    <add mimeType="message/*" enabled="true" /> 
    <add mimeType="application/javascript" enabled="true" /> 
    <add mimeType="application/x-javascript" enabled="true" /> 
    <add mimeType="image/jpeg" enabled="true" /> 
    <add mimeType="*/*" enabled="false" /> 
  </staticTypes> 
  <dynamicTypes> 
    <add mimeType="text/*" enabled="true" /> 
    <add mimeType="message/*" enabled="true" /> 
    <add mimeType="application/javascript" enabled="true" /> 
    <add mimeType="application/x-javascript" enabled="true" /> 
    <add mimeType="image/jpeg" enabled="true" /> 
    <add mimeType="*/*" enabled="false" /> 
  </dynamicTypes> 
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="4" /> 
</httpCompression>
</system.webServer>

这样做之后,我重新启动了iis以防万一.加载网页时,未将js文件或html文档压缩.

After doing this I restarted iis just in case. On loading the webpage no js file or html document got gziped.

推荐答案

可能您已经解决了此问题,它只是发生在我身上,我在寻找错误时发现了此问题.我有完全相同的web.config配置(在使用IIS 7.5的较旧的Web服务器上可以完美运行).

Probably you have already fixed this issue, it just happened to me and I found this while looking for the error. I had the exact same web.config configuration (worked perfectly on older webserver with IIS 7.5).

我发现您需要转到服务器管理器,并确保已在Web服务器=> Web服务器=>性能下设置了动态内容压缩功能.

I found that you need to go to Server Manager and make sure that you have setup the Dynamic Content Compression feature, under Web Server => Web Server => Performance.

这篇关于在IIS 8和Windows 8中设置gzip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆