none
There was an error reading from the pipe: The pipe has been ended

    Question

  • The use of WCF for my project is to have a Windows Service be under control of a user run application. Sofar that is working out pretty well. Passing data types in both directions is all very well but I've run into this odd snag when one List<Class> has something in it. This bewilders me since I am bidirectionally throwing an entire XML file (as data types, not a string) without a problem.

    The scenario: A form is requesting every five seconds the status of the service and it returns a class (Let's call this class "Pskyer"). Inside this class is an Enum, a String and List<Class> which contains some strings (call the Class "Hood").

    Trouble is, when that List<Hood> has anything in it, I get the above error. How can I pin down the exact error?

    Monday, January 28, 2013 3:43 PM

Answers

  • I think I have solved it. The "Hood" is not a serializable class, but it is now and is returning as expected.
    • Marked as answer by Zero Serenity Thursday, January 31, 2013 2:31 PM
    Wednesday, January 30, 2013 3:46 PM

All replies

  • Can you include some code samples as to how you are communicating with the server? Are you using WCF or WCF Data Services?

    Thanks,

    Chris Robinson - WCF Data Services


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, January 28, 2013 4:28 PM
  •     class ClientCommunications // : IPsykerWCF
        {
            readonly TimeSpan Timeout = new TimeSpan(0, 0, 0, 2);
            readonly TimeSpan LongTimeout = new TimeSpan(0, 10, 0);
            ServiceEndpoint Endpoint;
            ChannelFactory<IPsykerWCF> Factory;
            IPsykerWCF Channel;
            Int32 CurrentFaultCount = 0;
            public ClientCommunications()
            {
                Endpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(IPsykerWCF)),
                        new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress("net.pipe://localhost/PsykerService/PsykerWCF"));
                SetShort();
            }
            private void SetShort()
            {
                Factory = new ChannelFactory<IPsykerWCF>(Endpoint);
                if (Factory.State != CommunicationState.Opened)
                {
                    Factory.Open(Timeout);
                }
                Channel = Factory.CreateChannel();
                GC.KeepAlive(Endpoint);
                GC.KeepAlive(Factory);
                GC.KeepAlive(Channel);
            }
    		...
            internal PsykerStatus GetComponentStatus()
            {
                try
                {
                    return Channel.GetComponentStatus();
                }
                catch (Exception ex)
                {
                    EventLogging.WriteLog(ex);
                    FaultReset();
                    return null;
                }
            }
    		...		
            private void FaultReset()
            {
                CurrentFaultCount++;
                if (CurrentFaultCount >= 10 || Factory.State == CommunicationState.Faulted)
                {
                    //Reset the factories since they seem to not be working.
                    try
                    {
                        Factory.Close();
                    }
                    catch (Exception ex) { }
                    try
                    {
                        Endpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(IPsykerWCF)),
                        new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), new EndpointAddress("net.pipe://localhost/PsykerService/PsykerWCF"));
                        Factory = new ChannelFactory<IPsykerWCF>(Endpoint);
                        if (Factory.State != CommunicationState.Opened)
                        {
                            Factory.Open(Timeout);
                        }
                        Channel = null;
                        Channel = Factory.CreateChannel();
                        CurrentFaultCount = 0;
                    }
                    catch (Exception ex)
                    {
                        EventLogging.WriteLog(ex);
                    }
                }
            }
    	}

    That communicates to the server.

    Was there something more you were looking for?

    Monday, January 28, 2013 4:46 PM
  • Yes, that helps, your question is more related to WCF than WCF Data Services so moving your question to a more appropriate forum.

    Thanks,

    Chris


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, January 28, 2013 6:07 PM
  • Hi,

    What it the detail error message? Please try enable tracing for your service to help to dignose the actual issue.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 29, 2013 9:32 AM
    Moderator
  • I can't enabling tracing with the info you provided since my service doesn't use a config file.

    Here's a stack trace I can see, but I don't know if it's helpful.

       at System.ServiceModel.Channels.PipeConnection.FinishSyncRead(Boolean traceExceptionsAsErrors)
       at System.ServiceModel.Channels.PipeConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
      
    What were you looking for?

    Tuesday, January 29, 2013 8:13 PM
  • I think I have solved it. The "Hood" is not a serializable class, but it is now and is returning as expected.
    • Marked as answer by Zero Serenity Thursday, January 31, 2013 2:31 PM
    Wednesday, January 30, 2013 3:46 PM
  • Hi,

    Thanks for your feedback. Glad to hear that the issue has resolved.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 31, 2013 1:24 AM
    Moderator