WCF 在客户端"More data was expected, but EOF was reached."异常,但在服务器端命中请求



我看到在服务端调用WCF服务(netttcpbinding)时在客户端有以下异常的日志。但关键的部分甚至是客户端在其应用程序中面临异常,但请求已成功命中WCF服务。

消息:预期有更多数据,但已达到EOF。

消息:在流(状态:开始)的位置1读取消息帧格式时出错堆栈跟踪:
at System.ServiceModel.Channels.ClientDuplexConnectionReader.EnsureDecoderAtEof()
at System.ServiceModel.Channels.SessionConnectionReader。接收(超时时间)
在System.ServiceModel.Channels.SynchronizedMessageSource。接收(超时时间)
在System.ServiceModel.Channels.TransportDuplexSessionChannel。接收(超时时间)
在System.ServiceModel.Channels.TransportDuplexSessionChannel。TryReceive(TimeSpan timeout, Message&
at System.ServiceModel.Dispatcher.DuplexChannelBinder。请求(消息消息,超时时间)
在System.ServiceModel.Channels.ServiceChannel。Call(String action, Boolean one - way, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy。InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime操作)
在System.ServiceModel.Channels.ServiceChannelProxy. .Invoke(IMessage message) Exception rethrown

我怀疑这可能是由于以下原因发生的,因为我无法看到由于一些安全问题发送到WCF服务的数据。场景:

  1. 发送到WCF服务的数据可能有EOF字符。
  2. 发送到WCF服务的数据大小将大于在客户端WCF配置中配置的大小(maxReceivedMessageSize)。

我试图在我的本地机器上重现场景,我无法重现它。对于第一个场景,我将EOF字节(0x1A)包含在要发送到WCF服务的有效负载数据中。但它不会在客户端抛出任何异常。对于第二个场景,我配置的maxReceivedMessageSize值小于有效负载数据大小,它抛出异常,但它是不同的异常。

这个异常的原因是什么?如何在我的本地复制此异常?

问题是由于负载平衡器超时配置。

当WCF服务处理请求的时间超过负载均衡器配置时间时,在客户端发生EOF异常。

感谢黄澜为我指引了正确的方向。

相关内容

最新更新