ASP Response.Flush()刷新部分数据 [英] ASP Response.Flush() flushes partial data

查看:104
本文介绍了ASP Response.Flush()刷新部分数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有ASP服务器端的Web应用程序,我使用iframe进行数据推送。

I am developing a web app with an ASP server side and I use an iframe for data push.

ASP处理程序每​​隔一段时间刷新一次javascript到iframe:

An ASP handler flushes every once in a while some javascript to the iframe:

context.Response.Write("<script language='javascript'>top.update('lala');</script>");
context.Response.Flush();

我的问题是,有时候,当我收到数据时,我没有得到全文。
例如我会收到:< script language ='javascript'> update('lala');< /
不幸的是这个如果在下一秒左右没有其他数据出现,则会阻止执行javascript代码。

My problem is that sometimes, when I receive the data, I don't get the full text. For example I will receive this : <script language='javascript'>update('lala');</ Unfortunately this prevents the javascript code from being executed if no other data is to come during the next second or so.

我有一个解决方法是让线程刷新'... .......'每500ms。 (然后我将收到脚本> ...... 这将完成我的javascript。)

One workaround I have is to have a thread flushing '..........' every 500ms. (Then I will receive script>...... which will complete my javascript.)

但是我我确定必须有一种方法让Response.Flush()发送整个数据块。
有人知道如何正确使用Response.Flush()吗?

However I am sure there must be a way to have Response.Flush() sending the whole chunk of data. Does someone have an idea on how to use properly Response.Flush() ?

谢谢!

Charles

推荐答案

我的一位同事发现了这个问题。在IIS上启用了Gzip压缩,这阻止了Web浏览器获取完整的数据块。

One of my coworkers figured out the problem. Gzip compression was enabled on IIS, which was preventing the web browsers getting full chunks of data.

解决方案中包括:

禁用所有网站的压缩:

对于IIS 5.1,请转到控制面板/管理工具/互联网信息服务。右键单击网站,单击属性并删除ISAPI过滤器压缩

For IIS 5.1, go to Control Panel/Administrative Tools/Internet Information Services. Right click on Web Sites, click on properties and remove the ISAPI filter Compression.

对于IIS 7,请转到我的文档/ IISExpress / config / applicationHost.config 和更改 httpCompression 部分,以便不为您的特定页面启用压缩。

For IIS 7, go to My Documents/IISExpress/config/applicationHost.config and change the part httpCompression so that compression is not enabled for your particular page.

仅为您的网站:

在您应用的 web.config 文件中,添加<$ b行c $ c>< urlCompression doStaticCompression =truedoDynamicCompression =false/> 在< system.webServer> 部分下。

In the web.config file of your application, add the line <urlCompression doStaticCompression="true" doDynamicCompression="false"/> under the section <system.webServer>.

禁用特定网页或特定请求的压缩

这些好处伙计们找到了办法:

These good guys found a way to do it:

可以选择性地禁用gzip压缩i n ASP.NET / IIS 7?

这篇关于ASP Response.Flush()刷新部分数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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