问题
Can IIS / ASP.NET make use of the TCP keepalive option to detect dead connections? Note that these connections do not have the HTTP Keep-Alive option in effect. These are connections, just abandoned by the clients, leaving IIS / ASP.NET threads hanging, waiting for data. Are there mechanisms in place by which IIS / ASP.NET handles such scenarios?
回答1:
ASP.NET only handles HTTP data sent over the connection, the period where there is no HTTP happening, but the TCP connection is kept alive means nothing to it.
IIS will not keep the TCP connection alive indefinitely, but periodically checks them for idleness.
回答2:
IIS has the option to open the connection as with TCP KeepAlives enabled, but all research suggests it uses the system setting for it. The system defaults to enabled with 2hr KeepAliveTimes.
http://support.microsoft.com/kb/120642 has references for registry values.
来源:https://stackoverflow.com/questions/3832072/how-does-iis-asp-net-handle-dead-connections-no-http-keep-alive-in-effect