我有一个双工 WCF 服务和客户端在同一台机器上运行。客户端配置为 15 秒超时:
<binding name="NetTcpBinding_IServiceIPC" closeTimeout="00:00:15"
openTimeout="00:00:15" receiveTimeout="00:00:15" sendTimeout="00:00:15" />
客户端正在处理这样的错误:
client.InnerChannel.Faulted += FaultHandler;
client.InnerDuplexChannel.Faulted += FaultHandler;
client.ChannelFactory.Faulted += FaultHandler;
TimeoutException
如果我终止我的服务进程,客户端会在 15 秒后正确获得:
This request operation sent to net.tcp://localhost:8732/Service/ did not receive a reply within the configured timeout (00:00:15). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client. (System.TimeoutException)
但是,此时通道没有故障。我的故障处理程序直到我终止服务进程后大约 5 分钟才被调用。我认为 aTimeoutException
会使频道出错(请参阅此答案),但不知何故,情况似乎并非如此。有什么方法可以在服务进程被杀死后强制通道更快地出现故障?