Can an Abort () call to the IClientChannel proxy throw an exception?

Based on the documentation and articles, it is recommended to call Abort () on the client proxy if an unexpected exception / error occurs. See the following (simplified):

MyServiceClient proxy = null;
try {
    proxy = new MyServiceClient();
    proxy.DoSomething();
    proxy.Close();
} catch (Exception ex) {
    if (proxy != null)
        proxy.Abort();
}

Is it possible to call Abort () throwing the exception itself? Should the call to Abort () be within its own attempt / catch?

+3
source share
1 answer

No, Abort will not work (but .Close () or .Dispose () can). Calling .Abort () is the sledgehammer method to terminate the channel - it simply breaks down, regardless of the current message processing.

- , .Close() . .

+3

Source: https://habr.com/ru/post/1717580/


All Articles