title: WCF Duplex Contract
body: <p>Say I have WCF service contract like this</p>
  
  <pre><code>[ServiceContract(CallbackContract = typeof(ICallback1),
  SessionMode = SessionMode.Required)]
  public interface IService1
  {
    // some methods
  }
  </code></pre>
  
  <p>The service implementation has <code>InstanceContextMode.Single</code> set for <code>InstanceContextMode</code>
  and <code>ICallback1</code> is something like  </p>
  
  <pre><code>public interface ICallback1
  {
      [OperationContract]
      void Report(int someValue);
  }
  </code></pre>
  
  <p>Now on client side, I can have a class the implements ICallback1 like </p>
  
  <pre><code>class Callback1 : ICallback1
  {
      public void Report(int someValue)
      {
          // alert client
      }
  }
  </code></pre>
  
  <p>and I create client service reference like this </p>
  
  <pre><code>Service1Client serviceClient = new Service1Client(new InstanceContext(new CallBack1())); 
  </code></pre>
  
  <p>which works fine. Now the problem is that I have some clients that are not interested in the callback so I figured I do not require to implement the callback interface for such clients so I tried this</p>
  
  <pre><code> Service1Client serviceClient = new Service1Client(null);
  </code></pre>
  
  <p>and</p>
  
  <pre><code> Service1Client serviceClient = new Service1Client(new InstanceContext(null));
  </code></pre>
  
  <p>both reported that the <code>parameter cannot be null</code>. My question is, how can i create a service reference without passing a callback object if the client is not interested in the callback. The only requirement is that all clients should be talking to the same service but otherwise I can restructure the service however. Any thoughts ?</p>
  
  <p>EDIT:</p>
  
  <p>I have also tried  <code>SessionMode = SessionMode.Allowed</code> for ServiceContract instead of <code>SessionMode.Required</code> but that didn't help either.</p>