我用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是唯一可以避免这种超时的吗?
我也尝试在一个单独的线程中进行所有处理,所以服务可以更早断开连接,但没有成功。
我有太多的WCF超时问题等等。所以我决定切换回asmx。你也许可以先升级到.NET 4.我听说有许多WCF的改进,如果你有这个胃的话。 – 2010-05-06 06:48:35
@JL WCF对我来说工作得很好。这里的问题是,我有这么多的连接,没有服务可以处理它。所以我修改了客户端以减少通话次数。 – 2010-05-06 12:48:43