2
当客户端向IIS发送请求时,客户端和服务器之间存在连接。 如果客户端请求a.aspx,a.aspx中的代码如下。何时关闭http连接
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
Thread.Sleep(1000);
Response.Write(i+"<br>");
Response.Flush();
}
}
因此,这意味着连接保持10秒钟。是不是【问题1】
10秒之后,所述连接将被关闭【问题2】
如果我编辑与代码 '而(真)',如下:?
while(true)
{
Thread.Sleep(1000);
Response.Write(i+"<br>");
Response.Flush();
}
连接总是活着?或者什么时候会超时?【问题3】
这些是我的问题。
您可能会发现这一点很有趣,但它不能回答您的问题。也有一些“长期投票”框架,你可以谷歌以及可能会感兴趣。 http://encosia.com/easy-incremental-status-updates-for-long-requests/ – AaronLS
[HTTP Keep Alive持续时间和TCP超时持续时间之间的关系]的可能重复(http://stackoverflow.com/questions/2735883/relation-between-http-keep-alive-duration-and-tcp-timeout-duration) – Liam