1
votes

My client keep complaining that they are receiving Timeout error but I don't see a trace file generated on my side. Can anybody tell me how to fix this?

I already increase the receiveTimeout to 15 minutes (00:15:00). I did this both on WCF service side and on the client side. My service is not a long running process, the client should receive the response in 0 - 2 minutes max.

Not only receiveTimeout and I set the all timeouts to 00:15:00, also I set the serviceThrottling (maxConcurrentCalls,maxConcurrentInstances,maxConcurrentSessions) to 200.

Note: When ever there is an Timeout error, I don't see anything related to that in Tracing.

Here is my config files,

WCF Service Config:

<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="150" maxRequestLength="8192" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="MYWS" name="MYDEMO.MYDEMOCLS">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureBinding" name="wsDemo" contract="MYINTERFACES.ICustomer">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" name="wsMex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.1/Customer/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MYWS">
<serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="200" maxConcurrentSessions="200" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="SecureBinding" maxBufferPoolSize="2147483647" closeTimeout="00:15:00" openTimeout="00:15:00" receiveTimeout="00:15:00" sendTimeout="00:15:00" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>

Client Config:

<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="150" />
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsDemo" closeTimeout="00:15:00" openTimeout="00:15:00" receiveTimeout="00:15:00" sendTimeout="00:15:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:15:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.1/DEMOSVCS/Customer.svc" binding="wsHttpBinding" bindingConfiguration="wsDemo" contract="PROJ.IFACE" name="wsDemo">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>

Here is a client code

DemoClient client = new DemoClient("wsDemo"); 
DemoResponse DemoResponse = new DemoResponse(); 
try 
{ 
    DemoResponse = client.CreateProduct(product); 
    client.Close(); 
    return DemoResponse; 
} 
catch (Exception ex) 
{ 
    try 
    { 
        if (client.State == CommunicationState.Faulted) 
            client.Abort(); 
        else 
            client.Close(); 
        throw ex; 
    } 
    catch 
    { 
        client.Abort(); 
        throw ex; 
    } 
} 

Thanks

1
Is this the code from the actual client config file or is it your version of it? I'm asking because you have debug="true" set and executionTimeout set. When debug="true" then the executionTimeout doesn't have any effect but as soon as you set it to false, then it will.evasilchenko
Show us the client calling code. How do you close the proxy?oleksii
code DemoClient client = new DemoClient("wsDemo"); DemoResponse DemoResponse = new DemoResponse(); try { DemoResponse = client.CreateProduct(product); client.Close(); return DemoResponse; } catch (Exception ex) { try { if (client.State == CommunicationState.Faulted) client.Abort(); else client.Close(); throw ex; } catch { client.Abort(); throw ex; } } code Here is my code, its missing format.CoolArchTek
DeviantSeev I think I have debug set to 'true'. I will check it anyways. What else you see wrong in it? @oleksii see my previous comment. I added the code there.CoolArchTek
@CoolArchTek what kind of service instance management do you use? Singleton? Maybe the is a pile of requests queued while a singleton struggle to process the requests and some of them expire? As to config in your app it is actually only one config that matter for timeouts, the one on the client, as the service doesn't use any callback contract.oleksii

1 Answers

0
votes

Timeout errors are hard to diagnose. We've had issues that were completely related to WAN latency while passing large datasets across the wire.

However, if you find that once the timeout occurs, no further calls to the web service can be made, I would look into this WCF 3.5 & 4.0 Hotfix