在Azure网站上启用gzip压缩

时间:2015-09-04 21:01:32

标签: asp.net azure compression gzip azure-web-sites

我在使用标准层的azure网站上运行ASP.NET应用程序。我一直试图让gzip压缩工作。我修改了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>

使用IIS express在本地运行时可以正常工作,但在部署到azure时无效。响应包含以下标题。

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

1 个答案:

答案 0 :(得分:3)

您缺少/opt/opencv2.4.9/lib/python2.7/dist-packages元素

<scheme>

更多信息:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModel.DataTypes

<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />