title: WCF TimeoutException caused by maxReceivedMessageSize
body: <p>We noticed that our application which uses netTcpBinding suddenly stopped working. After examining the event log on the server which hosts the service, I found the following warning (one of series of many):</p>
  
  <blockquote>
    <p>Exception information: 
        Exception type: TimeoutException 
        Exception message: The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may
    have been a portion of a longer timeout.</p>
    
    <p>Server stack trace:     at
    System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)<br>
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan
    timeout)    at
    System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan
    timeout, CallOnceManager cascade)    at
    System.ServiceModel.Channels.ServiceChannel.EnsureOpened(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)</p>
  </blockquote>
  
  <p>To fix the issue, I had to increase the size of maxReceivedMessageSize by 10, so my new binding looks like this:</p>
  
  <pre><code>&gt;  &lt;netTcpBinding&gt;
  &gt;     &lt;binding name="largeBufferNetTcpBinding" listenBacklog="100" maxBufferSize="519730000" maxConnections="100"
  &gt;              maxReceivedMessageSize="519730000" portSharingEnabled="true"&gt;
  &gt;       &lt;readerQuotas maxArrayLength="519730000"/&gt;
  &gt;       &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/&gt;
  &gt;       &lt;security&gt;
  &gt;         &lt;message clientCredentialType="Windows"/&gt;
  &gt;       &lt;/security&gt;
  &gt;     &lt;/binding&gt;
  &gt;     &lt;binding name="defaultNetTcpBinding" portSharingEnabled="true"/&gt;
  &gt;     &lt;binding name="defaultNetTcpMexBinding" portSharingEnabled="true"&gt;
  &gt;       &lt;security mode="None"/&gt;
  &gt;     &lt;/binding&gt;      &lt;/netTcpBinding&gt;
  </code></pre>
  
  <p>I don't understand how the maxReceivedMessageSize is related to the TimeoutException shown above. What can I do to troubleshoot this further and make the service more reliable?</p>