Azure 网站提供静态 JS/CSS 但不是二进制的速度很慢 [英] Azure Website slow to serve static JS/CSS but not binary

查看:16
本文介绍了Azure 网站提供静态 JS/CSS 但不是二进制的速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Azure 网站/Web 应用程序,它提供静态 JS 和 CSS 文件的速度非常慢,但提供二进制文件似乎非常好.

I have an Azure Website/Web App that is incredibly slow to serve static JS and CSS files but seems perfectly fine serving binary.

为了测试问题,我上传了两个 30MB 的文件,一个是 big.js,另一个是 big.rar.如果幸运的话,JS 文件的下载速度约为 100KB/s.RAR 文件的下载速度约为 4,000KB/s.结果非常一致.

To test the problem I uploaded two 30MB files, one big.js and the other big.rar. The JS file downloads at around 100KB/s if I'm lucky. The RAR file downloads at around 4,000KB/s. The results are extremely consistent.

我已经检查了 Fiddler,并且在这两种情况下都发生了 gzip 压缩.正如预期的那样,JS 文件使用 MIME 类型 application/x-javascript 发送,而 RAR 文件作为 application/octet-stream 发送.

I've checked in Fiddler and gzip compression is occurring in both cases. As expected, the JS file is being sent with the MIME type application/x-javascript whereas the RAR file is being served as application/octet-stream.

我很难理解这一点 - 为什么 IIS 提供一种类型的静态内容比另一种慢得多?

I am struggling to understand this - why would IIS serve one type of static content so much slower than another?

推荐答案

我们遇到了这个问题,并在 Azure 支持团队的帮助下解决了这个问题.问题是慢速文件会使用 TransferEncoding: Chuncked.他们建议我们强制静态压缩来解决这个问题.

We had this issue, and was able to resolve this with the help of Azure Support Team. The issue was that the slow files would use TransferEncoding: Chuncked. They suggested that we force static compression to get around this issue.

我们必须将以下内容添加到 <system.webServer>:

We had to add the following to <system.webServer>:

<serverRuntime enabled="true"  frequentHitThreshold="1"  frequentHitTimePeriod="00:00:20" />

这篇关于Azure 网站提供静态 JS/CSS 但不是二进制的速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆