title: The open operation did not complete within the allotted timeout of 00:01:00 - AX 2012 using AIF/WCF
body: <p>I am having a problem with <code>AIF</code> in <code>AX 2012</code> when it deals with a big amount of data that takes a long time. I am using the adapter <code>NetTCP</code> and I am having the following exception while consuming  the web service using an WebForm application.</p>
  
  <pre><code>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.
  
  InnerException:The socket transfer timed out after 00:00:59.9990234. You have exceeded the timeout set on your binding.
   The time allotted to this operation may have been a portion of a longer timeout.
  
  InnerException:A connection attempt failed because the connected party did not properly respond after a period of time, 
  or established connection failed because connected host has failed to respond
  </code></pre>
  
  <p>The application code is basically ( I am even opening and closing the connection in each loop), like in the topic <a href="http://msdn.microsoft.com/en-us/library/aa548693.aspx" rel="nofollow">Error message: The open operation did not complete within the allotted timeout</a>:</p>
  
  <pre><code>public void CreateFromCSVFile(Stream fileStream)
          {
              ExportingData_Test.VendVendServices.VendTableServiceClient VenSvcClient = new VendTableServiceClient();
  
              try
              {
                  List&lt;string[]&gt; VendData = Helper.ImportCSVFile.ParseCSVFile(fileStream, true);
  
                  foreach (string[] vendor in VendData)
                  {
                        VenSvcClient = new VendTableServiceClient();
  
                         VenSvcClient.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 1, 10, 0);
                         VenSvcClient.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 1, 10, 0);
                         VenSvcClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, 1, 10, 0);
                         VenSvcClient.Endpoint.Binding.CloseTimeout = new TimeSpan(0, 1, 10, 0);
  
                          VenSvcClient.Open();
  
                          //DO SOME OPERATION IN HERE
                          //Create the Vendor
  
                          entityKey = VenSvcClient.create(callContext, axdVendor);
                          VenSvcClient.Close();
                   }
              }
              catch (Exception ex)
              {
                  String message = ex.Message;
              }
             finally
             {
                 VenSvcClient.Close();
             }
          }
  </code></pre>
  
  <p>I tried to configurate the enhaced port using the <a href="http://community.dynamics.com/product/ax/axtechnical/b/goshoom/archive/2011/06/16/ax2012-service-configuration-editor.aspx" rel="nofollow">Microsoft Service Configuration Editor</a>, that is used to configure the WCF underneath, increasing most of the properties:</p>
  
  <p>In <strong>Host</strong>:</p>
  
  <ol>
  <li>CloseTimeout to 00:10:00 </li>
  <li>OpenTimeout to  00:10:00</li>
  </ol>
  
  <p>In <strong>Bindings</strong>:</p>
  
  <ol>
  <li>MaxReceivedMessageSize to 1004857600. like in <a href="http://msdn.itags.org/visual-studio/89112/" rel="nofollow">here</a> advised.</li>
  <li>MaxBufferSize to 1004857600. </li>
  <li>MaxBufferPoolSize to 1004857600. </li>
  <li>ReceivedTimeout 01:10:00</li>
  <li>SendTimeout 01:10:00</li>
  <li>MaxBytesPerRead 1004857600</li>
  <li>InactivityTimeout 01:10:00</li>
  <li>ReliableSessionProperty false</li>
  </ol>
  
  <p>But I am still getting the same error. </p>