将这一行添加到 web.config 有什么作用?

发布于 2024-10-07 15:53:46 字数 353 浏览 0 评论 0原文

我在此处阅读了有关内容 关于我们应该添加的 ASP.NET 应用程序的改进 -

<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>

谁能用简单的话解释一下它的作用以及每个 .NET 应用程序都应该添加它吗?

I read about here in respect to improvements in asp.net applications that we should add -

<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>

Can anyone please explain in simple words what this does and should every .net application should have this added ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

零度℉ 2024-10-14 15:53:46
  • 元素的 doDynamicCompression 属性可在站点、应用程序或文件夹级别启用或禁用动态内容压缩。
  • 元素的 doStaticCompression 属性可在网站、应用程序或文件夹级别启用或禁用静态内容压缩。
  • dynamicCompressionBeforeCache 属性指定 IIS 是否动态压缩尚未缓存的内容。当dynamicCompressionBeforeCache 属性为true 时,IIS 在第一次发出请求时动态压缩响应,并将内容排队以进行压缩。后续请求将动态提供服务,直到压缩响应已添加到缓存目录中。将压缩的响应添加到缓存目录后,缓存的响应将发送到客户端以供后续请求。当dynamicCompressionBeforeCache为假时,IIS返回未压缩的响应,直到压缩的响应被添加到缓存目录。

取自 iis.net

  • The doDynamicCompression attribute of the element enables or disables dynamic content compression at the site, application, or folder level.
  • The doStaticCompression attribute of the element enables or disables static content compression at the site, application, or folder level.
  • The dynamicCompressionBeforeCache attribute specifies whether IIS will dynamically compress content that has not been cached. When the dynamicCompressionBeforeCache attribute is true, IIS dynamically compresses the response the first time a request is made and queues the content for compression. Subsequent requests are served dynamically until the compressed response has been added to the cache directory. Once the compressed response is added to the cache directory, the cached response is sent to clients for subsequent requests. When dynamicCompressionBeforeCache is false, IIS returns the uncompressed response until the compressed response has been added to the cache directory.

taken from iis.net

獨角戲 2024-10-14 15:53:46

压缩有助于节省带宽,并可能减少页面加载时间。启用压缩后,服务器基本上会在将文件发送到客户端之前对其进行 gzip 压缩。这可能会占用更多的 CPU 时间来进行压缩,但这样做可以节省传输时间。

动态压缩将启用对动态脚本(如 aspx 页面)的压缩。

静态压缩将启用静态文件(如 html 文件和图像)的压缩。

Compression can help save bandwidth, and potentially decrease page loading times. With compression enabled, the server basically gzips the files before sending them to the client. This can take up a little more CPU time to do the compression, but the idea is that you will save time during transmission.

Dynamic compression will enable compression on dynamic scripts like aspx pages.

Static compression will enable compression on static files like html files and images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文