使用"System.Web.Optimization"压缩由asp.net捆绑创建的捆绑包? [英] Compression of bundles created by asp.net bundling using 'System.Web.Optimization'?

本文介绍了使用"System.Web.Optimization"压缩由asp.net捆绑创建的捆绑包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用MS的新捆绑和缩小包在asp.net Web解决方案中创建了捆绑包.一切都已正确捆绑和最小化(使用global.asax方式),但是当我在IIS上部署时,捆绑没有得到压缩(gzip),我不想启用动态压缩(因为它将压缩所有动态内容),只是想要仅压缩捆绑包.

I have created bundles in my asp.net web solution by using the new bundling and minification package by MS. Everything is properly bundled and minified (used global.asax way) but when I deploy on IIS the bundle is not getting compressed (gzip) , I don't want to enable dynamic compression (as it will compress all dynamic content), just want to compress bundles only.

该怎么办?

捆绑输出的mime类型是什么,就像这里名为'Jquery'的捆绑一样:

What is the mime type of a bundled output, like for this bundle named 'Jquery' here :

"http://Myhost/MySite/JQuery?v=1Oof3SDB0npBNcnfiEpdM9WovwwmP-UGKz3QrSQLPPQ1"

因此,我可以在httpCompression部分的webconfig文件中添加相同的文件以进行gzip压缩.

So I can add the same in webconfig file in httpCompression section for gzip compression.

关于,高拉夫

推荐答案

我在IIS7中启用了动态压缩,除了启用动态压缩外,没有其他类似的方法来压缩包,尽管建议您仅在以下情况下实施此方法:如果您使用的是IIS7或更高版本,则较低版本中的动态压缩未经过优化,因此会加重服务器的负担.

I enabled dynamic compression in IIS7, there is not other way to compress bundles like this other than enabling dynamic compression, although it is advised that you implement this only if you are using IIS7 or above, dynamic compression in lower versions is not optimized and will tax your server.

实施此解决方案后,可以在生产上运行我的解决方案.

Running my solution on production after implementing this without any issues.

这篇关于使用"System.Web.Optimization"压缩由asp.net捆绑创建的捆绑包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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