title: How to increase the web service timeout in a Windows Service application?
body: <p>I am working on a web application that uses an asmx web service to import data in IIS7.  We have a Windows Service pick up a file to import and send it thru the web service.  I am getting the following error during large imports after 1 minute:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>I have seen plenty of posts where the suggestion is to not have a web service call that runs that long.  I agree in principle, but this is a low traffic, internal web site.  Until proven otherwise, I believe the amount of work to re-architect the other portions of the system will be longer than updating the timeout.</p>
  
  <p>So far we have tried updating the <a href="http://msdn.microsoft.com/en-us/library/ms731361.aspx" rel="nofollow">basicHttpBinding</a> properties in the web.config, specifically the openTimeout, receiveTimeout, sendTimeout and closeTimeout properties.  There was no change to the behavior.</p>
  
  <p>We also tried setting these properties in the code that makes the call to the web service after the object is constructed.  Still no luck.</p>
  
  <p>I looked thru the IIS settings and do not see any timeout value that is currently set to 60 seconds.  We also tried bumping up the executionTimeout in the web.config to no effect.</p>
  
  <p>What configuration value am I missing?  Are there any other ways to modify a timeout?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>As requested, here are the configs:</p>
  
  <p>App.config</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;bindings&gt;
              &lt;basicHttpBinding&gt;
                  &lt;binding name="ImportServiceSoap" closeTimeout="00:02:00" openTimeout="00:02:00"
                      receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
                      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                      maxBufferSize="1265536" maxBufferPoolSize="12524288" maxReceivedMessageSize="1265536"
                      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                      useDefaultWebProxy="true"&gt;
                      &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                          maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                      &lt;security mode="None"&gt;
                          &lt;transport clientCredentialType="None" proxyCredentialType="None"
                              realm="" /&gt;
                          &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                      &lt;/security&gt;
                  &lt;/binding&gt;
              &lt;/basicHttpBinding&gt;
          &lt;/bindings&gt;
          &lt;client&gt;
              &lt;endpoint address="http://mysite.com/Importservice.asmx"
                  binding="basicHttpBinding" bindingConfiguration="ImportServiceSoap"
                  contract="ImportService.ImportServiceSoap" name="ImportServiceSoap" /&gt;
          &lt;/client&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Web.config (abridged, connectionstrings removed):</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;system.web&gt;
        &lt;roleManager enabled="false" cacheRolesInCookie="false" defaultProvider="AspNetSqlRoleProvider" /&gt;
        &lt;siteMap defaultProvider="MenuElementsProvider"&gt;
        &lt;/siteMap&gt;
        &lt;compilation debug="false" targetFramework="4.0"&gt;
        &lt;/compilation&gt;
        &lt;customErrors mode="RemoteOnly" defaultRedirect="Shared/Internal_Server_Error.html"&gt;
          &lt;error statusCode="404" redirect="Shared/Internal_Server_Error.html" /&gt;
          &lt;error statusCode="500" redirect="Shared/Internal_Server_Error.html" /&gt;
        &lt;/customErrors&gt;
        &lt;authentication mode="Windows" /&gt;
        &lt;identity impersonate="true" /&gt;
        &lt;authorization&gt;
          &lt;allow users="*" /&gt;
        &lt;/authorization&gt;
        &lt;trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /&gt;
        &lt;sessionState mode="InProc" stateConnectionString="tcpip=127.1.0.1" cookieless="false" timeout="30" /&gt;
        &lt;globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="en-US" /&gt;
        &lt;httpRuntime maxRequestLength="102400" requestValidationMode="2.0" executionTimeout="14400" /&gt;
      &lt;/system.web&gt;
      &lt;location path="DefaultWsdlHelpGenerator.aspx"&gt;
        &lt;system.web&gt;
          &lt;pages styleSheetTheme="" /&gt;
          &lt;httpRuntime maxRequestLength="1048576" executionTimeout="3600" /&gt;
        &lt;/system.web&gt;
      &lt;/location&gt;
      &lt;system.webServer&gt;
        &lt;validation validateIntegratedModeConfiguration="false" /&gt;
      &lt;/system.webServer&gt;
    &lt;/appSettings&gt;
  &lt;/configuration&gt;
  </code></pre>