Search code examples
wcfcallbacknetnamedpipebinding

WCF pipe connection aborted with error:There was an error reading from the pipe: Unrecognized error 109


I am designing a WCF service with callback using named pipe binding. And when I call the service from the client, on the server side tracing it shows the error "There was an error reading from the pipe: Unrecognized error 109" and eventually the pipe connection got aborted. But I have absolutely no clue what caused the problem. The tracing doesn't give more information except the stack trace:

System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error,   Int32 numBytes)
System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

and another 109 error with stack trace

System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)

I suspected it has something to do with the return value of the operation based on the tracing activities flow. But even if I declare return type of the operation as void, I still get this error. Another thing is although I am using callback, but it doesn't call the callback inside the operation.

Any help will be appreciated, or guide me on how to debug the pipe connection aborted, I bet there is some way to get more verbose information. For example how to catch the exception mentioned above(try catch block inside the server operation doesn't get anything, neither does the client side calling function).


Solution

  • Turned out I didn't call the client.Close() function in some stage. So when the client program exit, the channel got aborted and the server showed the mentioned error