【发布时间】:2010-11-18 22:33:25
【问题描述】:
我正在尝试记录客户端在 Web 服务调用中超时时发生的情况。
看看下面的 HelloWorld 代码。这是我想做的,但似乎 IsClientConnected 不起作用,因为它总是返回 true。
[WebMethod]
public string HelloWorld() {
//.. Do the Webservice stuff
if (!Context.Response.IsClientConnected) {
//Log some vital info about this call that timed out...
}
return "The WebService Result";
}
有没有人知道另一种检查 Web 服务调用状态的方法?
当客户端与 Web 服务调用断开连接时,Web 服务中不会引发异常。代码继续运行,直到完成,然后将其结果返回到虚无中(因为连接已关闭)。
【问题讨论】:
-
IIS 版本对 IsClientConnected 的准确性有很大影响。我很想看看其他人想出什么来解决这个问题轮询。
标签: .net web-services timeout