奇怪的 WCF net.tcp 异常
我有一个带有 net.tcp 传输的 WCF 客户端/服务。当我在客户端打开 WCF 跟踪时,我在跟踪中看到以下错误(请参阅服务跟踪查看器的屏幕截图)。奇怪的是,WCF 正在处理和恢复此错误,而我的客户端没有收到任何异常并且它继续工作。此异常经常、随机发生,但并非在每个 Web 方法调用中都发生。 客户端(Windows XP)身份验证是 Windows,服务由 SPN 标识,服务在 NLB(Windows Server 2003)后面的 Windows 服务上自托管。 谁能解释一下这里发生了什么。
跟踪 xml 中的异常堆栈跟踪为:
<ExceptionString>
System.ServiceModel.Security.MessageSecurityException: The server rejected the upgrade request. ---> System.ServiceModel.ProtocolException: Error while reading message framing format at position 0 of stream (state: ReadingUpgradeRecord) ---> System.IO.InvalidDataException: More data was expected, but EOF was reached.
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
</ExceptionString>
:
I have a WCF client/service with net.tcp transport. When I turn on the WCF tracing on client side I am seeing the following errors in trace (see screenshot from service trace viewer). The strange thing is that WCF is handling and recovering this error and my client doesn't receive any exception and it continues to work. This exception happens freqently, randomly but not on every web method call.
The client (windows XP) authentication is windows, service is identified by SPN, services are self-hosted on windows service behind an NLB (windows server 2003).
Can anyone explain me what is happening here.
The exception stacktrace from the trace xml is:
<ExceptionString>
System.ServiceModel.Security.MessageSecurityException: The server rejected the upgrade request. ---> System.ServiceModel.ProtocolException: Error while reading message framing format at position 0 of stream (state: ReadingUpgradeRecord) ---> System.IO.InvalidDataException: More data was expected, but EOF was reached.
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
</ExceptionString>
:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定真正的问题是什么以及它是否与流媒体有关(我将深入探讨)。无论如何,您可以尝试在服务器端捕获异常并抛出 CommunicationException 。
这样,客户端代理不应忽略异常,并且其状态应为“故障”。
Not sure what the real problem could be and if it's related to streaming (I'll dive in). Anyway you can try catch the exception on the server side and throw a CommunicationException instead.
This way the client proxy should not ignore the exception and it's state should be "Faulted".