如何在 runAllManagedModulesForAllRequests 设置为 true 的情况下在 IIS 7 中禁用 flv 文件的 gzip 压缩?
我有一个在 IIS 7 上运行的 ASP.NET 3.5 网站,我希望将我的静态内容(如 css 文件、javascript 文件等)和动态内容(.net 页面)进行 gzip 压缩。问题是我需要确保 flv 文件(Flash 视频文件)不是 gzip 压缩的,因为这会导致我正在使用的 Flash 视频播放器出现问题, Flowplayer。
我已将以下行添加到我的 web.config 中,以启用压缩,但随后我的 flv 文件也被 gzip 压缩:
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
我尝试将以下内容添加到我的 web.config 中,但它没有改变任何内容:
<httpCompression>
<staticTypes>
<remove mimeType="video/x-flv"/>
</staticTypes>
<dynamicTypes>
<remove mimeType="video/x-flv"/>
</dynamicTypes>
</httpCompression>
我有关闭 doDynamicCompression 以使 flv 文件不被 gzip 压缩。我认为它将 flv 文件视为动态内容,因为我在 web.config 中有 runAllManagedModulesForAllRequests="true" (我需要它来处理路由中的一些事情)。
总之,如何禁用 flv 文件的 gzip 压缩?
I have an ASP.NET 3.5 Website that is running on IIS 7 and I would like to have my static content (like css files, javascript files, etc) gzip compressed as well as my dynamic content (.net pages). The problem is that I need to make sure flv files (flash video files) are not gzip compressed because that causes problems with the flash video player I'm using, Flowplayer.
I've added the following line to my web.config which enables compression, but then my flv files are also being gzip compressed:
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
I've tried to add the following to my web.config, but it did not change anything:
<httpCompression>
<staticTypes>
<remove mimeType="video/x-flv"/>
</staticTypes>
<dynamicTypes>
<remove mimeType="video/x-flv"/>
</dynamicTypes>
</httpCompression>
I have to turn off doDynamicCompression for the flv files not to be gzip compressed. I think that it is treating flv files as dynamic content because I have runAllManagedModulesForAllRequests="true" in my web.config (which I need for some of the things I'm doing with routing).
In summary, how do I disable gzip compression for flv files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最好的办法是手动管理 gzip 压缩的内容。有时,经过 gzip 压缩的内容实际上会增加大小,例如 swf,这就是我刚刚遇到的情况。以前我的 application.config 中有这个块,在我删除 shockwave mime 类型 swf 后停止压缩
这是在 windows\system32\intersrv\config\application.config 中我的应用程序配置中 但我很确定您可以在
system.webserver
下的 web.config 中为每个网站执行此操作。我所要做的就是删除冲击波哑剧类型,它不再被压缩,但所有其他有效的哑剧类型都被压缩了。
I think the best thing to do is to manually manage what is getting gzip'd. Sometimes what is gzip'd can actually increase in size, like a swf, which is what I just ran into. Previously my
application.config
had this block in it, and after I removed the shockwave mime type swf's stopped compressingThis is in my application config in
windows\system32\intersrv\config\application.config
but I am pretty sure you can do this per website in your web.config undersystem.webserver
.All I had to do for me was to remove the shockwave mime type and it stopped getting compressed but all other valid mime types were.