Home > Enterprise >  WCF "More data was expected, but EOF was reached." exception at client side, but the reque
WCF "More data was expected, but EOF was reached." exception at client side, but the reque

Time:09-27

I am seeing the logs which has the below exception at client side while calling WCF service (NetTcpBinding) in service side. But the crusial part is even the client facing the exception in their application but the request was successfully hit the WCF service.

Message: More data was expected, but EOF was reached.

Message: Error while reading message framing format at position 1 of stream (state: Start) Stack Trace:
at System.ServiceModel.Channels.ClientDuplexConnectionReader.EnsureDecoderAtEof()
at System.ServiceModel.Channels.SessionConnectionReader.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.SynchronizedMessageSource.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceive(TimeSpan timeout, Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown

I suspect it may be occured due to below reasons, since i could not see the data that was sent to the WCF service due to some scurity issue. Scenarios:

  1. The data that was sent to the WCF service might have EOF character.
  2. The data size that was sent to the WCF service would be larger than the size that was configured (maxReceivedMessageSize) in the WCF configuration at client side.

I was trying to reproduce the scenario in my local machine, i am unable to reproduce it. For the first scenario, i included the EOF byte (0x1A) in the payload data to sent to WCF service. but it does not throw any exception at client side. for the second scenario, i configured the maxReceivedMessageSize value less than the payload data size, it throws the exception, but it was different exception.

What could be the reason for this exception? How to reproduce this exception in my local?

CodePudding user response:

The issue is because of load balancer timeout configuration.

The EOF exception is occurred at client side, when the WCF service processes the request more than load balancer configuration time.

Thanks @Lan Huang for navigating me to the right direction.

  • Related