WCF NamedPipe CommunicationException - “The pipe has been ended. (109, 0x6d).”

前端 未结 9 1256
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 13:18

I am writing a Windows Service with accompanying \"status tool.\" The service hosts a WCF named pipe endpoint for inter-process communication. Through the named pipe, the

9条回答
  •  隐瞒了意图╮
    2020-12-16 13:55

    The IP Address was, it turns out, a complete red herring.

    The real reason for the exception was invalid Enum values being returned by the WCF service.

    My enum was defined thusly:

    [DataContract]
    public enum MyEnumValues : Byte
    {
        [EnumMember]
        Enum1 = 0x10,
        [EnumMember]
        Enum2 = 0x20,
        [EnumMember]
        Enum3 = 0x30,
        [EnumMember]
        Enum4 = 0x40,
    } 
    

    It looks fine on the surface.

    But the raw status reported by the underlying service was a Byte value of "0," and there was no corresponding Enum value for which to cast it.

    Once I ensured that the Enum values were all valid, the tool lit up like a Christmas tree.

    When in doubt, assume your WCF data is invalid.

提交回复
热议问题