title: WCF Error 109: here was an error reading from the pipe. The pipe is closed on the client side
body: <p>I am getting the following error on my client app </p>
  
  <pre><code>There was an error reading from the pipe: De pipe is beëindigd. (109,0x6d).
  </code></pre>
  
  <p>when using a specific implementation of my OperationContract. The following is a sample cut down to the point. 
  My DataContracts as like this:</p>
  
  <pre><code>[DataContract]
  public class Person
  {
      [DataMember]
      public string FirstName { get; set; }
      [DataMember]
      public string LastName { get; set; }
  }
  
  [DataContract]
  public class Employee : Person
  {
      [DataMember]
      public string Function { get; set; }
  }
  </code></pre>
  
  <p>And my ServiceContract looks like this:</p>
  
  <p>[ServiceContract]
  public interface IAuthentication
  {</p>
  
  <pre><code>[OperationContract]
  [WebGet]
  Person GetDeveloper();
  
  [OperationContract]
  [WebGet]
  Person GetArchitect();
  </code></pre>
  
  <p>}</p>
  
  <p>I implement this service like the following class:</p>
  
  <pre><code>public class Authentication : IAuthentication
  {
      public Person GetDeveloper()
          {
              Person architect = new Person()
              {
                  FirstName = "Asghar",
                  LastName = "Panahy"
              };
              return architect;
          }
  
          public Person GetArchitect()
          {
              Employee architect = new Employee()
              {
                  FirstName = "Asghar",
                  LastName = "Panahy",
                  Function = "Architect"
              };
              return architect;
          }
  }
  </code></pre>
  
  <p>Note: Both methods return the same type, only one instanciates a Person and returns it while the second method instanciates an Employee which is a Person too.</p>
  
  <p>When I call it from the client I do not get any error on the server but on the client side:</p>
  
  <pre><code>Console.WriteLine(" Connecting to Authenticate service... ");
  
              NetNamedPipeBinding myBinding = new NetNamedPipeBinding("Authentication.Endpoint"); ;
              EndpointAddress myEndpoint = new EndpointAddress("net.pipe://localhost/authentication"); ;
              var myChannelFactory = new ChannelFactory&lt;IAuthentication&gt;(myBinding, myEndpoint);
  
              IAuthentication proxy = myChannelFactory.CreateChannel();
              Person person = proxy.GetDeveloper();
              Console.WriteLine(String.Format("GetDeveloper OK : {0} {1} ", person.FirstName, person.LastName));
  
              person = proxy.GetArchitect();
              Console.WriteLine(String.Format("GetArchitect OK : {0} {1} ", person.FirstName, person.LastName));
  </code></pre>
  
  <p>and the output is:</p>
  
  <p>Connecting to Authenticate service...
  GetDeveloper OK : Asghar Panahy 
  There was an error reading from the pipe: De pipe is beëindigd. (109, 0x6d).</p>
  
  <p>Could anyone please help me on this?
  Asghar</p>