【发布时间】:2011-03-29 05:04:31
【问题描述】:
再次更新赏金,因为我真的需要知道如何让它发挥作用,或者明确回答为什么它不会。
I've added an alternative explanation of the problem here.
让双向 (IsOneWay = false) WCF 客户端-服务器在 .Net 3/3.5 中工作真是太棒了。
客户端成功注册服务后,服务的周期性 Announcement() 回调到注册的客户端。现在是客户端或服务器挂起,直到服务器的 SendTimeout(调整为 2 秒)过去。那么服务器端出现超时异常如下。只有这样,客户端用户代码才会立即接收方法调用并尝试返回一个值。到那时,客户端的套接字被中止并且 WCF 的东西失败了。
在我看来,客户端上的某些东西正在将其本地 WCF 队列从处理中挂起,直到套接字超时,但还不足以取消本地方法调用。但是,如果可以相信以下异常,则服务器正试图向http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous 发送操作(不合适!)并且正在超时。也许该 URI 只是远程连接客户端的“名称”,因为 WCF 知道出于错误消息的目的引用它,它似乎只是意味着它无法加载 URI。分不清是服务端先失败还是客户端先失败。
我已尝试添加 WCF 跟踪,但没有获得更多信息。
Similar sample code is here,但肯定是太难消化了。我已经尝试过该代码的变体。
TimeoutException 'This request operation sent to http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous did not receive a reply within the configured timeout (00:00:00). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.'
Server stack trace:
at System.ServiceModel.Dispatcher.DuplexChannelBinder.SyncDuplexRequest.WaitForReply(TimeSpan timeout)
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)
【问题讨论】:
-
这适用于 3.0/3.5,而不是 4.0。谢谢。
-
您是否在客户端和服务器上都使用了 wcf 跟踪来查看它是否显示了什么?
-
是的,尽我所能解释结果,我只发现与上面列出的相同的异常。否则,所有排序和消息都会显示正确。
-
我只是觉得你可能达到了 WCF 连接限制(我认为它默认为 10),然后 2 分钟后 WCF 可能会超时并允许另一个连接制作。
-
不,我没有达到极限。第一次失败。
标签: wcf callback duplex timeoutexception