У меня есть дуплексная служба 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 минут после того, как я уничтожу процесс службы. Я думал, что TimeoutException
выведет канал из строя (см. этот ответ), но почему-то это не так . Можно ли каким-либо образом ускорить отказ канала после того, как процесс службы будет убит?