[英]WCF "More data was expected, but EOF was reached." exception at client side, but the request hit in server side
在服務端調用 WCF 服務(NetTcpBinding)時,我看到在客戶端出現以下異常的日志。 但關鍵部分甚至是客戶端在其應用程序中面臨異常,但請求已成功命中 WCF 服務。
消息:預計會有更多數據,但已達到 EOF。
消息:在 stream 的 position 1 處讀取消息幀格式時出錯(狀態:開始)堆棧跟蹤:
在 System.ServiceModel.Channels.ClientDuplexConnectionReader.EnsureDecoderAtEof()
在 System.ServiceModel.Channels.SessionConnectionReader.Receive(時間跨度超時)
在 System.ServiceModel.Channels.SynchronizedMessageSource.Receive(時間跨度超時)
在 System.ServiceModel.Channels.TransportDuplexSessionChannel.Receive(時間跨度超時)
在 System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceive(時間跨度超時,消息和消息)
在 System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(消息消息,TimeSpan 超時)
在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,Boolean 單向,ProxyOperationRuntime 操作,Object[] 輸入,Object[] 輸出,TimeSpan 超時)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime 操作)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息) 異常重新拋出
我懷疑它可能是由於以下原因而發生的,因為由於某些安全問題,我看不到發送到 WCF 服務的數據。 場景:
我試圖在我的本地機器上重現該場景,但我無法重現它。 對於第一種情況,我在有效載荷數據中包含 EOF 字節 (0x1A) 以發送到 WCF 服務。 但它不會在客戶端拋出任何異常。 對於第二種情況,我將 maxReceivedMessageSize 值配置為小於有效負載數據大小,它會引發異常,但它是不同的異常。
此異常的原因可能是什么? 如何在我的本地重現此異常?
問題是由於負載平衡器超時配置。
EOF 異常發生在客戶端,當 WCF 服務處理請求超過負載均衡器配置時間時。
感謝@Lan Huang 引導我走向正確的方向。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.