gpt4 book ai didi

c# - 你应该压缩 html 页面吗?如果是这样,如何在 .net 中做到这一点?

转载 作者:太空宇宙 更新时间:2023-11-03 16:53:14 38 4
gpt4 key购买 nike

我正在查看我在 yslow 中的表现,尽管我压缩了我的 css 和 js 脚本,它说我应该压缩我的 html 页面。

Compression reduces response times by reducing the size of the HTTP response. Gzip is the most popular and effective compression method currently available and generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip.

我想知道我应该这样做吗?如果是这样,在将 asp.net mvc 与 C# 结合使用时,您如何做到这一点?

最佳答案

是的,您应该这样做,它会显着减少传递给客户端的负载(更快的页面加载,耶!)。这是在 IIS 中完成的(如果你有这个选项,它不是唯一的选项,例如 blowery 等)。

免责声明:这样做会一些消耗 CPU 来实际进行压缩。但是,根据我的经验,这总是是值得的。如果您有一个极高流量的网站,您可能需要权衡成本(尽管如果您为带宽付费,我敢打赌这仍然是一个明显的胜利)。

关于c# - 你应该压缩 html 页面吗?如果是这样,如何在 .net 中做到这一点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3182623/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com