3

I am getting the following error on my client app

There was an error reading from the pipe: De pipe is beëindigd. (109,0x6d).

when using a specific implementation of my OperationContract. The following is a sample cut down to the point. My DataContracts as like this:

[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; }
}

And my ServiceContract looks like this:

[ServiceContract] public interface IAuthentication {

[OperationContract]
[WebGet]
Person GetDeveloper();

[OperationContract]
[WebGet]
Person GetArchitect();

}

I implement this service like the following class:

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;
        }
}

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.

When I call it from the client I do not get any error on the server but on the client side:

Console.WriteLine(" Connecting to Authenticate service... ");

            NetNamedPipeBinding myBinding = new NetNamedPipeBinding("Authentication.Endpoint"); ;
            EndpointAddress myEndpoint = new EndpointAddress("net.pipe://localhost/authentication"); ;
            var myChannelFactory = new ChannelFactory<IAuthentication>(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));

and the output is:

Connecting to Authenticate service... GetDeveloper OK : Asghar Panahy There was an error reading from the pipe: De pipe is beëindigd. (109, 0x6d).

Could anyone please help me on this? Asghar

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • similar question here might help: http://stackoverflow.com/questions/4872352/very-strange-behaviour-fixing-the-unrecognized-error-109-0x6d-by-modify-con – Adam Butler Nov 28 '11 at 05:31
  • Can you please translate "De pipe is beëindigd" into English? Also, should you be using WebGet with NetNamedPipeBinding? – John Saunders Jul 09 '09 at 07:36
  • I don't know, but since WebGet is for HTTP, try to remove it and let's see what happens. – John Saunders Jul 09 '09 at 08:20

1 Answers1

3

I know the question is a bit old but I might still help someone. I have the same problem now with the named-pipe binding(getting the same error).

The problem here is the return of the Employee derived class. There is a good explanation here

So it should work fine if you apply the KnownTypeAttribute:

[DataContract]
[KnownType(Employee)]
public class Person
...
Ventsyslav Raikov
  • 6,882
  • 1
  • 25
  • 28