1

I have a WCF Service which is hosted. The service calls takes anywhere between 30 secs or more than a few minutes (but less than 10) to perform its processing as per the business requirements. I am facing a problem when the client is behind the proxy and the processing on the server side is greater than 1 min. If the processing is less than 1 min, the call succeeds without any problem. This indicates that there is no issue with the connenctivity to the server through proxy. However the issue is more with timeout at the proxy server.

I get the following exception

The request channel timed out while waiting for a reply after 00:09:59.9619962.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 ConsoleApplication1.ServiceReference1.IMyService.GeneratePackage(Guid clientId) at ConsoleApplication1.ServiceReference1.MyClient.GeneratePackage(Guid clientId) in F:\Code\Samples\ConsoleApplication1\ConsoleApplication1\Service References\ServiceReference1\Reference.cs:line 398 at ConsoleApplication1.Program.Main(String[] args) in F:\Code\Samples\ConsoleApplication1\ConsoleApplication1\Program.cs:line 26

My Configuration section looks like

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

I have tried the following options:

1) Implemented a MessageInspector and set the "Keep-Alive" to "2000000". 2) Checked the request and response through Fiddler and see HTTP/1.1 504 Connection Timed Out

My understanding is that the proxy is not waiting beyond a minute even though all the timeouts are set at the WCF service level.

How do I ensure that proxy waits till the WCF service call returns?

Would appreciate if I can get inputs to solve this problem.

user613098
  • 43
  • 1
  • 4
  • I think your answer is right here: http://stackoverflow.com/a/424386/2517785 – Ilkka Jun 28 '13 at 11:45
  • As I said in the problem statement, the timeouts are set for 10 minute but that is not having an impact and the call fails after a minute. Moreover if it was a WCF service timeout issue, the problem should occur even in a non-proxy environment, which is not the case here. – user613098 Jun 28 '13 at 12:01

0 Answers0