Silverlight ClientHttp WebRequest 超时 [英] Silverlight ClientHttp WebRequest timeout

查看:24
本文介绍了Silverlight ClientHttp WebRequest 超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Silverlight 4 应用程序,它使用 ClientHttp 堆栈来创建一个 WebRequest,它提供一个二进制流.然后我从这个流中读取并做一些事情.但是,我有以下问题:服务器缓冲它发送下来的数据,因此发送过程就像发送-暂停-发送-暂停-发送...

I have a silverlight 4 application using the ClientHttp stack to make a WebRequest which serves a binary stream. I then read from this stream and do stuff. However, I have the following problem: the server buffers the data that it sends down, so that the send process is like send-pause-send-pause-send...

有时服务器会暂停更长的时间(大约 20 秒),此时连接似乎以某种方式中断.我在 Silverlight 中没有发现任何异常,实际上代码看起来像是从 Web 响应流读取完成(即没有更多数据).但是,服务器实际上并未向下发送其所有数据(我可以从非 Silverlight 应用程序中进行测试,该应用程序将在暂停后获取更多数据).我认为这可能是一些超时问题(根据我在 Silverlight 中阅读的内容无法明确设置),但奇怪的是我没有收到指示超时的异常.此外,暂停时间并不长,我希望 20 秒是一个合理的时间.

Sometimes the server takes a little longer pause (around 20 seconds), at which point the connection seems to somehow break. I don't get any exception in Silverlight, actually to the code it looks like the read from the web response stream finished ok (i.e. no more data). However, the server did not actually send all its data down (which I can test from a non-Silverlight application that will get more data after that pause). I'm thinking this might be some timeout issue (which from what I read around one can't set in Silverlight explicitly), but it's weird that I don't get an Exception indicating the timeout. Also, the pause is not that long, I would expect 20sec to be a reasonable time.

我还查看了 TCP 流量,看起来在暂停之后,Silverlight 向服务器发送了一条 FIN 消息.所以它似乎有点超时并决定断开连接,但它实际上并没有将超时报告为异常或给我任何避免它的方法.

I've also looked at the TCP traffic and looks like after the pause, Silverlight sends a FIN message to the server. So it seems like it kind of times out and decides to break the connection, but it doesn't actually report the timeout as an Exception or give me any way to avoid it.

任何想法实际发生了什么以及我如何防止它?

Any ideas what's actually going on and how could I prevent it?

谢谢!

更新:发现问题.有一个注册表项可以控制系统范围内的 Web 请求超时行为,一些应用程序将其设置为 10 秒(例如,Install Anywhere)并忘记"将其设置回来.关键是这样的:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ReceiveTimeout

UPDATE: Found the problem. There is a registry key that controls system-wide web request timeout behavior and some apps set it to 10 seconds (e.g. Install Anywhere) and "forget" to ever set it back. The key is this: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ReceiveTimeout

我把它改回了一个更大的值,现在它工作正常了!嗯.

I changed it back to a greater value and now it works fine! Hth.

推荐答案

仅引用 OP 但提供答案:

Merely quoting the OP but providing an answer:

更新:发现问题.有一个注册表项可以控制系统范围内的 Web 请求超时行为,一些应用程序将其设置为 10 秒(例如,Install Anywhere)并忘记"将其设置回来.关键是这样的:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ReceiveTimeout

UPDATE: Found the problem. There is a registry key that controls system-wide web request timeout behavior and some apps set it to 10 seconds (e.g. Install Anywhere) and "forget" to ever set it back. The key is this: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ReceiveTimeout

我把它改回了一个更大的值,现在它工作正常了!嗯.

I changed it back to a greater value and now it works fine! Hth.

这篇关于Silverlight ClientHttp WebRequest 超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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