我试图支持IIS下的静态文件的GZip压缩(默认情况下应该启用但不能)但到目前为止还没有工作.这是<system.webServer>Web应用程序的web.config文件中节点下的部分;
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" />
Run Code Online (Sandbox Code Playgroud)
我尝试使用谷歌浏览器.这是请求标题;
接受:text/html,application/xhtml + xml,application/xml; q = 0.9,/ ; q = 0.8
接收字符集:ISO-8859-1,utf-8; Q = …
我想使用GZIP压缩我的文件.你能分享使用GZIP压缩文件的web.config代码吗?
上传我的web.config文件后还有什么需要做的吗?
我有一个运行IIS的Server 2012 R2盒子.我已经尝试为在该盒子上运行的几个站点启用压缩,但我无法弄清楚它为什么不起作用.我的请求标题都显示为accept-encoding,但响应标头始终为Transfer-Encoding:chunked和Vary:Accept-Encoding.已执行以下步骤以尝试使gzip压缩工作:
已经进行了跟踪以了解为什么没有发生压缩.我唯一的信息是代码DYNAMIC_COMPRESSION_NOT_SUCCESS,原因是1.
以下是标题:
GET http://redactedservername:8082/ HTTP/1.1
Host: redactedservername:8082
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: ASP.NET_SessionId=gnqovt55ggt22lycufudc0ns
Run Code Online (Sandbox Code Playgroud)
`
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Date: Wed, 22 Jun 2016 14:00:57 GMT
Transfer-Encoding: chunked
Run Code Online (Sandbox Code Playgroud)
可以执行哪些其他步骤来使压缩工作?