我用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