Note that there are some explanatory texts on larger screens.

plurals
  1. PODuplex channel Faulted event does not rise on second connection attempt
    text
    copied!<p>I have regular net.tcp WCF service client, and regular net.tcp <strong>duplex</strong> (i.e. with a callback) WCF service client. I have implemented some logic to constantly reinstantiate the connection in case a service has faulted.</p> <p>They are created in the exactly same way:</p> <pre><code>FooServiceClient Create() { var client = new FooServiceClient(ChannelBinding); client.Faulted += this.FaultedHandler; client.Ping(); // An empty service function to make sure connection is OK return client; } BarServiceClient Create() { var duplexClient = new BarServiceClient(new InstanceContext(this.barServiceCallback)); duplexClient.Faulted += this.FaultedHandler; duplexClient.Ping(); // An empty service function to make sure connection is OK return duplexClient; } public class Watcher { public Watcher() { this.CommunicationObject = this.Create(); } ICommunicationObject CommunicationObject { get; private set; } void FaultedHandler(object sender, EventArgs ea) { this.CommunicationObject.Abort(); this.CommunicationObject.Faulted -= this.FaultedHandler; this.CommunicationObject = this.Create(); } } </code></pre> <p>The <code>FaultedHandler()</code> aborts the channel and <strong>recreates</strong> it using the code above.</p> <p>The <code>FooServiceClient</code> reconnection logic works just fine, it is being reconnected after many faults. Whereas, almost the same but duplex <code>BarServiceClient</code> receives Faulted event only from the first <code>BarServiceClient</code> instance, i.e <strong>once</strong>.</p> <p>Why only the firsts instance of duplex <code>BarServiceClient</code> gets faulted event? Are there any workarounds?</p> <hr> <p>A similar non answered question: <a href="https://stackoverflow.com/questions/4703732/wcf-reliable-session-without-transport-security-will-not-faulted-event-on-time">WCF Reliable session without transport security will not faulted event on time</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload