[英]Enabling gzip compression on Azure Websites
I have an ASP.NET application running on an azure website using the standard tier. 我有一个使用标准层在azure网站上运行的ASP.NET应用程序。 I have been trying to get gzip compression working on it.
我一直试图让gzip压缩工作。 I've modified my
web.config
file and added the following under system.webServer
我修改了我的
web.config
文件,并在system.webServer
下添加了以下内容
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<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="*/*" enabled="false"/>
</dynamicTypes>
<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="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
This works when running locally with IIS express but does not work when deployed to azure. 这在使用IIS express本地运行时有效,但在部署到azure时不起作用。 The response contains the following headers.
响应包含以下标头。
Accept-Ranges:bytes
Content-Length:5381
Content-Type:text/css
Date:Fri, 04 Sep 2015 20:44:01 GMT
ETag:"56386b2e88dad01:0"
Last-Modified:Wed, 19 Aug 2015 14:06:02 GMT
Server:Microsoft-IIS/8.0
X-Powered-By:ASP.NET
You are missing the <scheme>
element 您缺少
<scheme>
元素
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
More info here: 更多信息:
https://www.iis.net/configreference/system.webserver/httpcompression/scheme https://www.iis.net/configreference/system.webserver/httpcompression/scheme
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<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="*/*" enabled="false"/>
</dynamicTypes>
<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="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.