title: SQL connection timeout
body: <p>We have been facing weird connection timeouts on one of our websites.</p>
  
  <p>Our environment is composed of an IIS 7 web server (running on Windows Server 2008 R2 Standard Edition) and an SQL Server 2008 database server.</p>
  
  <p>When debugging the website functionality that provokes the timeout, we notice that the connection itself takes milliseconds to complete, but the <code>SqlCommand</code>, which invokes a stored procedure on the database, hangs for several minutes during execution, then raises the timeout exception. </p>
  
  <p>On the other hand, when we run the stored procedure directly on the database, it takes only 2 seconds to correctly finish execution.</p>
  
  <p>We already tried the following:</p>
  
  <ul>
  <li>Modified <code>SqlCommand</code> timeout on the website code</li>
  <li>Modified execution timeout on the <code>web.config</code> file</li>
  <li>Modified <code>sessionState</code> timeout on the <code>web.config</code> file</li>
  <li>Modified authorization cookie timeout on the <code>web.config</code> file</li>
  <li>Modified the connection timeout on the website properties on IIS</li>
  <li>Modified the application pool shutdown time limit on IIS</li>
  <li>Checked the application pool idle timeout on IIS</li>
  <li>Checked the execution timeout on the SQL Server properties (it's set to 0, unlimited)</li>
  <li>Tested the stored procedure directly on the database with other parameters</li>
  </ul>
  
  <p>We appreciate any help.</p>
  
  <p>Nirav</p>