Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF timeout not being honored

Tags:

wcf

timeout

I am new to a project that extensively uses WCF and my experience with WCF is not extensive. I am trying to track down an issue where my UI presents a timeout error after 10 minutes while waiting for a long-running service call to return. Very roughly here is what my project entails:

[service A] <=> [service B] <=> [UI console]

And here is what I have gleaned thusfar:

  • The timeout occurs between serviceA and serviceB, not between serviceB and the UI console, because I actually have two separate UI consoles: one is an MMC snap-in and one is a PowerShell snap-in, and both exhibit the same 10-minute timeout.

  • My endpoints in both serviceA and serviceB use basicHttpBinding; both have bindingConfigurations that specify sendTimeout and receiveTimeout at 30 minutes, not 10 minutes.

  • ReliableSession.InactivityTimeout defaults to 10 minutes I have read, but I do not believe either of these is a ReliableSession so it does not apply.

  • I instrumented serviceB for WCF tracing; ServiceTraceViewer showed the appropriate activity up to the start of the long-running service call, then nothing after that up to and including the 10-minute timeout.

Feel free to challenge me on any of my assertions and/or let me know what else I can do to diagnose this issue.

2013.04.04 Update

Here is the actual error message:

The request channel timed out while waiting for a reply after 00:09:59.9839984. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace: at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at NextIT.ActiveAdministration.DataContracts.IActiveAdministration.PublishAgentSettings() at ...

And the inner exception:

The HTTP request to 'http://localhost/MyAdminService/' has exceeded the allotted timeout of 00:10:00. The time allotted to this operation may have been a portion of a longer timeout.

at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

like image 941
Michael Sorens Avatar asked Apr 02 '13 22:04

Michael Sorens


1 Answers

There is an old adage "If it does not work, try plugging it in." I was so focused on wending my way through the harrowing twists and turns of the app.config file rife with conflagration and fraught with confusion--partly because there are actually 5 app.config files with a variety of bindings and services in this large project(!)--that I failed to notice the obvious part where the code was overriding the config file:

binding.ReceiveTimeout = new TimeSpan(0, 0, 10, 0);
binding.SendTimeout = new TimeSpan(0, 0, 10, 0);

Sigh.

But wait--there's more. I was initially scratching my head over why the 30 minute value from the config file had no effect because the timeout occurred at 10 minutes? Well, it turns out that the 10-minute timeout—set in code as shown above—was from UI console to serviceB. The 30-minute timeout—set in the config file—was from the serviceB to serviceA, so I had to open up both wider to let a long-running operation proceed.

like image 198
Michael Sorens Avatar answered Oct 04 '22 20:10

Michael Sorens