简体   繁体   English

在WCF中具有“无法识别的序列”消息的CommunicationException

[英]CommunicationException with 'not recognized sequence' message in WCF

I get a CommunicationException while using WCF service. 我在使用WCF服务时遇到了CommunicationException。 The message is: 消息是:

The remote endpoint no longer recognizes this sequence. 远程端点不再识别此序列。 This is most likely due to an abort on the remote endpoint. 这很可能是由于远程端点中止。 The value of wsrm:Identifier is not a known Sequence identifier. wsrm:Identifier的值不是已知的Sequence标识符。 The reliable session was faulted. 可靠的会议出了问题。

The exception is thrown in a moment after a contract method was called. 调用契约方法后,会抛出异常。 Before calling contract method the channel state is Opened. 在调用contract方法之前,通道状态是Opened。 I restore my service client after catching this exception and for some time it works fine. 我捕获此异常后恢复我的服务客户端,并且一段时间它工作正常。 But then this error occures again. 但是这个错误再次发生了。 It seems like some timeout is exceeded, but I can't understand which one exactly. 似乎超出了一些超时,但我无法理解究竟是哪一个。

I use wsHttpBinding with reliableSession enabled. 我使用带有reliableSession的wsHttpBinding。 The InactivityTimeout is set to half an hour and I'm sure it's not exceeded, because exception is thrown earlier. InactivityTimeout设置为半小时,我确信它没有被超过,因为异常被提前抛出。

I solved the problem. 我解决了这个问题。 The reason was RecieveTimeout on a server side. 原因是服务器端的RecieveTimeout。 It was set to 1 minute, so after having no requests during 1 minute server used to close a channel, and when client tried to call a contract, channel was already crashed due to the timeout. 它被设置为1分钟,因此在1分钟服务器用于关闭通道之后没有请求,并且当客户端试图调用合同时,由于超时,通道已经崩溃。

I found the solution after reading this article: 我在阅读本文后找到了解决方案:

http://msdn.microsoft.com/en-us/library/system.servicemodel.reliablesession.inactivitytimeout.aspx http://msdn.microsoft.com/en-us/library/system.servicemodel.reliablesession.inactivitytimeout.aspx

I received this error while setting up a new WCF service which returned a list of objects. 我在设置返回对象列表的新WCF服务时收到此错误。

My understanding is that WCF services can only pass very simple objects back n forth. 我的理解是WCF服务只能传递非常简单的对象。

So objects with anything other than public properties will not be transferable. 因此,除了公共属性之外的任何对象都不可转让。

The object had a read only property doing a bit of logic. 该对象有一个只读属性做一些逻辑。

Once I got rid of this, rebuilt, and updated the web references, the error went away. 一旦我摆脱了这一点,重建并更新了Web引用,错误就消失了。

Tip: If you're returning a object and it has properties check the gets and sets of each one. 提示:如果您要返回一个对象并且它具有属性,请检查每个对象的获取和设置。 We had a problem around it. 我们遇到了一个问题。

I have seen this happen when an application pool gets recycled. 我已经看到当应用程序池被回收时会发生这种情况。

Look at the very last section of this blog about service recycling . 请查看此博客的最后一部分,了解服务回收。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM