控制长时间运行的关键 ISAPI 进程
场景:
- 客户端通过 POST 向 IIS 7.5 服务器发出 ISAPI 调用 - 该调用将生成要分发给众多用户的关键任务输出。 (在本例中使用 Delphi XE 和 Indy 9 HTTP 客户端);
- ISAPI 进程需要很长时间才能完成(它在客户端线程化);
- 在 POST 调用返回之前,用户中止或客户端计算机出现故障,从而终止客户端连接并让 ISAPI 进程在 IIS 7.5 服务器上继续运行。
问题:
- 当客户端/用户中止并终止连接时,该线程仍在执行,IIS 7.5 对该线程执行什么操作?
- 即使客户端已断开连接,服务器端线程是否仍会完成处理,或者 IIS 7.5 是否会在某个时刻终止该线程,也许会在中止的进程中留下混乱?
- 这个时间是否取决于服务器端进程完成所需的时间?
- 这是否可以控制 - 即使客户端已中止,我是否可以指示 IIS 完成该过程?如果是这样,怎么办?
Scenario:
- Client makes ISAPI call with POST to IIS 7.5 server - the call will generate mission critical output to be distributed to numerous users. (using Delphi XE with Indy 9 HTTP client in this case);
- ISAPI process takes a LONG TIME to complete (it's threaded on the client side);
- Before the POST call returns, user aborts or client machine goes down, killing client side connection and leaving the ISAPI process chugging away on the IIS 7.5 server.
Questions:
- What does IIS 7.5 do with that thread, which is still executing when the client/user aborts and kills the connection?
- Will the server side thread complete processing even though the client has disconnected, or will IIS 7.5 kill that thread at some point, perhaps leaving a mess in the aborted process?
- Is this time dependent - depending on how long it takes for the server-side process to complete?
- Can this be controlled - can I instruct IIS to complete the process even though the client has aborted? If so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IIS 将继续处理直到完成,或者直到应用程序池超时。
您应该考虑使用 Indy 的 TIdHTTPServer,然后您将控制服务器端,这将允许您设置自己的规则来处理长时间且可能断开连接的客户端会话,而不是成为 IIS AppPool 管理方面的专家。
IIS will continue to process until completion, or until the timeout for the App Pool is hit.
You should look at using Indy's TIdHTTPServer and then you'll control the server side which will allow you to setup your own rules on how to handle a long and possibly disconnected client session instead of becoming an expert in IIS AppPool management.