【发布时间】:2015-11-30 19:18:42
【问题描述】:
我正在使用 WebPageTest 来测试我的 Azure Web 应用程序 (ASP.Net vNext Web API/Angular) 的性能。我的“压缩传输”和“缓存静态内容”都得到了 F。
在搜索 StackOverflow 和 Google 之后,我在 web.config 中添加了以下内容:
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
<httpCompression>
<dynamicTypes>
<clear />
<remove mimeType="*/*" />
<add enabled="true" mimeType="text/*"/>
<add enabled="true" mimeType="message/*"/>
<add enabled="true" mimeType="application/x-javascript"/>
<add enabled="true" mimeType="application/javascript"/>
<add enabled="true" mimeType="application/json"/>
<add enabled="false" mimeType="*/*"/>
<add enabled="true" mimeType="application/atom+xml"/>
<add enabled="true" mimeType="application/atom+xml;charset=utf-8"/>
</dynamicTypes>
<staticTypes>
<clear />
<remove mimeType="*/*" />
<add enabled="true" mimeType="text/*"/>
<add enabled="true" mimeType="message/*"/>
<add enabled="true" mimeType="application/javascript"/>
<add enabled="true" mimeType="application/atom+xml"/>
<add enabled="true" mimeType="application/xaml+xml"/>
<add enabled="true" mimeType="application/json"/>
<add enabled="false" mimeType="*/*"/>
</staticTypes>
</httpCompression>
和
<staticContent>
<!-- Set expire headers to 30 days for static content-->
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
重新部署我的 Web 应用程序后,我重新运行了测试,但我仍然得到了两个 F。尽管我已将这些设置添加到 web.config,但 Azure Web App 似乎并未支持它们。
另外,我发现一些 Web 应用层不允许压缩,但我在 S2 上运行,并且我验证它确实允许压缩。
任何帮助将不胜感激!
谢谢!
【问题讨论】:
标签: azure gzip azure-web-app-service http-caching http-compression