1

I just created a WCF service library. I created a test function and i invoked the test function from the WCF test client. I had put a break point in the code. The control reaches the break point and stops there. Now i let the control to stay at the break point for sometime and in about i minute the get the following error message

"Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service."

Error Details: The request channel timed out while waiting for a reply after 00:00:59.9843750. 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.Channels.ClientReliableChannelBinder1.RequestClientReliableChannelBinder1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode) at System.ServiceModel.Channels.ClientReliableChannelBinder1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode) at System.ServiceModel.Channels.ClientReliableChannelBinder1.Request(Message message, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 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 ITrustmarkService.StartRobotProcess() at TrustmarkServiceClient.StartRobotProcess()

Any idea what is causing this?

Sidharth
  • 1,251
  • 1
  • 25
  • 40

2 Answers2

2

This is a sample WCF client config from MSDN:

 <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_ISampleService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>

you should set receiveTimeout and sendtimout to appropriated value, you can see similar configuration in a config file of your test.

Saeed Amiri
  • 22,252
  • 5
  • 45
  • 83
  • @Sidharth To be completely correct you need to set both [binding.receiveTimeout](https://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.receivetimeout(v=vs.110).aspx) as well as [binding.ReliableSession.InactivityTimeout](https://msdn.microsoft.com/en-us/library/system.servicemodel.reliablesession.inactivitytimeout(v=vs.110).aspx) since either of those two expiring will close the connection. Both of those settings can be changed in the .config file, as above, or in code. – AlwaysLearning Sep 28 '17 at 04:48
0

Yes. By default WCF Service has a response timeout for 1 minute configured. That means clients can wait up to a minute and if they don't get a response in that time, they can assume failed/no response.

In your case, you are holding WCF service using a breakpoint to respond to client's request. And after waiting for a minute, client times out and doesn't wait anymore.

You can increase this timeout from WCF service's .config file.

decyclone
  • 30,394
  • 6
  • 63
  • 80