我试图支持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 = …
我有一个网站,它使用 ASP.NET 并托管在 IIS 7.5 共享主机上,因此我无法直接访问 IIS 设置。现在我想使用 IIS 功能启用我的页面和 css/js 文件的 gzip 压缩,但是在 Internet 上找到的任何方法都不适合我。例如,当我将这里写的内容添加到我的 Web.config 时,没有任何变化:没有错误,没有压缩。
这可能吗?如果没有,最好的选择是什么?