2010-05-05 81 views
0

我用netNamedPipeBinding,我的服务方法返回任何结果(void),但他们超时:如何避免WCF中的超时?

TimeoutException异常:“开放的操作没有的00:01:00在规定的超时时间内完成分配到的时间。这个操作可能是更长时间的一部分。“

服务器堆栈跟踪: 在System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(时间跨度超时) 在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时) 在System.ServiceModel.Channels.ServiceChannel.OnOpen(时间跨度超时) 在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时) 在System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(时间跨度超时,CallOnceManager级联) 在System.ServiceModel.Channels.ServiceChannel.EnsureOpened( TimeSpan超时) at System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Objec T []项,在System.ServiceModel.Channels.ServiceChannelProxy.Invoke对象[]奏,时间跨度超时) 在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括MethodCall,ProxyOperationRuntime操作) (即时聊天消息)

在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天reqMsg,即时聊天retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & MSGDATA,的Int32类型)

:[0]时异常重新抛出

为了避免这种情况,我把我的服务变成了OneWay操作。但超时仍然发生。我预计它解决了我的问题。它的netMsmqBinding是唯一可以避免这种超时的吗?

我也尝试在一个单独的线程中进行所有处理,所以服务可以更早断开连接,但没有成功。

+0

我有太多的WCF超时问题等等。所以我决定切换回asmx。你也许可以先升级到.NET 4.我听说有许多WCF的改进,如果你有这个胃的话。 – 2010-05-06 06:48:35

+0

@JL WCF对我来说工作得很好。这里的问题是,我有这么多的连接,没有服务可以处理它。所以我修改了客户端以减少通话次数。 – 2010-05-06 12:48:43

回答

1

我觉得这是连接超时。所以绑定不应该在其中起作用。这可能是服务接受调用有一些问题。你是如何部署它们的,或者在服务器端有没有问题?你可以做一些日志记录或跟踪? tracelistener可能会打开。

+0

这里的问题是我有这么多的连接,没有服务可以处理它。所以我修改了客户端以减少通话次数。 – 2010-05-06 12:54:16

+0

如果没有连接增加,并且网络能承受此连接,则可以使用Throttling来处理最大并发实例,并将其余部分保留在队列中。 – Kangkan 2010-05-07 03:49:42

+0

我使用单个实例。 – 2010-05-07 12:11:47