error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
Hi,
I just got an error in my client application that uses a wcf method to extract some data from a SQL Server database. The error was:
“Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding”
Obviously it’s a timeout issue due to complexity of the query. To fix this you would need to take alook at your binding settings in the App.config file. Typically there are a few timeout settings that you can modify there. Look under section and locate and then . You should see the settings for your timeouts like below:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="your service interface name" closeTimeout="00:18:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:18:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> . . . . </binding> </basicHttpBinding> </bindings> </system.serviceModel>
The sendTimeout shows how long the client will wait till it gets the response from WCF service. The format is hours:minutes:seconds. It shows the total time of sending a message through your service including receiving the reply message in a wcf request-reply case.
The closeTimeout shows how long you will wait before you close the connection before an exception is thrown. Usually this disposes the client WCF proxy.
In my case, I just increased the sendTimeout and closeTimeout and the problem was gone.
Cheers,
Nader Heshmat