【发布时间】:2011-02-16 00:48:00
【问题描述】:
我使用netNamedPipeBinding,我的服务方法没有返回任何内容 (void),但它们超时:
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(TimeSpan 超时,CallOnceManager 级联) 在 System.ServiceModel.Channels.ServiceChannel.EnsureOpened(时间跨度超时) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出,TimeSpan 超时) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime 操作) 在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)
在 [0] 处重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型)
为了避免这种情况,我将我的服务变成了OneWay 操作。但是超时仍然发生。我希望它解决了我的问题。只有 netMsmqBinding 可以避免这种超时?
我还尝试在单独的线程中进行所有处理,以便服务可以提前断开连接,但没有成功。
【问题讨论】:
-
我遇到了很多关于 WCF 的超时问题,等等。所以我决定切换回asmx。您或许可以从升级到 .net 4 开始。我听说 WCF 有很多改进,如果您愿意的话。
-
@JL WCF 对我来说工作正常。这里的问题是我有太多的连接,没有服务可以处理它。所以我修改了客户端以减少调用次数。