如何关闭HTTP COM pression用于下载的zip文件? [英] How to turn off HTTP compression for downloaded zip files?

查看:107
本文介绍了如何关闭HTTP COM pression用于下载的zip文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有使能(通过IIS设置)HTTP COM pression ASP.NET Web应用程序。其中一个应用程序的功能包括创建多个文本文件并封装为一个zip文件被用户下载。

I have an ASP.NET web application that has HTTP compression enabled (through IIS settings). One of the features of the app involves creating multiple text files and packaging them as a single zip file to be downloaded by the user.

使用HTTP COM $启用p $ pssion,由应用程序创建的文件被压缩两次 - 一次由Web应用程序,并通过一次HTTP COM pression以上;其结果是,当用户下载的zip文件,它有1文件,该文件是应用程序生成的ZIP文件,第二个zip文件具有原始内容。

With HTTP compression enabled, the files created by the application are zipped twice - once by the web application and once more by HTTP compression; with the result that when the user downloads the zip file, it has 1 file which is the application generated zip file, and this second zip file has the original contents.

我的要求是要禁用HTTP COM pression只为zip文件。我该如何实现这一目标?文件扩展名为ZIP不包括在COM pression元数据库文件。

My requirement is to disable HTTP compression only for the zip file. How do I achieve this? The file extension "zip" is not included in the metabase file for compression.

推荐答案

没关系,我发现这个问题是什么: http://support.microsoft.com/kb/841120

Never mind, I found what the issue is: http://support.microsoft.com/kb/841120

虽然这篇文章说的Sharepoint,相同的解决方案适用于我的情况也。我通过改变MIME类型固定为应用程序/八位字节流而不是应用程序/ x-ZIP-COM pressed在我的code(因为我生成动态的zip文件) 。这似乎已经解决了。

Though this article says Sharepoint, the same solution is applicable in my case also. I fixed it by changing the MIME type to "application/octet-stream" instead of "application/x-zip-compressed" in my code (since I'm generating the zip file on the fly). That seems to have fixed it.

这篇关于如何关闭HTTP COM pression用于下载的zip文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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