我有一个托管的WCF服务。服务调用需要30秒或几分钟(但小于10),以根据业务需求执行处理。当客户端在代理后面并且服务器端的处理大于1分钟时,我遇到问题。如果处理时间小于1分钟,则呼叫成功,没有任何问题。这表明通过代理与服务器的连接没有问题。但是,代理服务器上的超时问题更多。
我收到以下异常
请求频道在等待回复后超时 00:09:59.9619962。增加传递给调用的超时值 请求或增加Binding上的SendTimeout值。时间 分配给这个操作可能是一个更长的一部分 超时。
服务器堆栈跟踪:at System.ServiceModel.Channels.RequestChannel.Request(消息消息, TimeSpan超时)at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息 消息,TimeSpan超时)at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway,ProxyOperationRuntime操作,Object [] ins, 对象[]出局,TimeSpan超时)at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime operation)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天 消息)
在[0]处重新抛出异常:at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天 reqMsg,IMessage retMsg)at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; msgData,Int32类型)at ConsoleApplication1.ServiceReference1.IMyService.GeneratePackage(GUID clientId)at ConsoleApplication1.ServiceReference1.MyClient.GeneratePackage(GUID clientId)in F:\代码\样本\ ConsoleApplication1 \ ConsoleApplication1 \服务 参考文献\ ServiceReference1 \ Reference.cs:第398行 ConsoleApplication1.Program.Main(String [] args)in F:\代码\样本\ ConsoleApplication1 \ ConsoleApplication1 \的Program.cs:行 26
我的配置部分看起来像
<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" /> </diagnostics> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IMyService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="20000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="200000000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="None"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://TestServer.abc.co.za:8432/TestManager/MyService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService" contract="ServiceReference1.IMyService" name="WSHttpBinding_IMyService"> <identity> <dns value="TestServer.abc.co.za" /> </identity> </endpoint> </client> </system.serviceModel>
我尝试了以下选项:
1)实现MessageInspector并将“Keep-Alive”设置为“2000000”。 2)通过Fiddler检查请求和响应,并查看HTTP / 1.1 504连接超时
我的理解是,即使所有超时都设置在WCF服务级别,代理也不会等待超过一分钟。
如何确保代理等待WCF服务调用返回?
如果我能获得输入来解决这个问题,我将不胜感激。