title: How to recreate Execution Timeout Expired in EF6?
body: <p>I want to recreate one error scenario from application hosted on Azure.</p>
  <p>While updating entities ( while importing some files from excel ) there is an error throwed :</p>
  <pre><code>System.Data.SqlClient.SqlException: Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  </code></pre>
  <p>error occurs when SaveChanges() is called</p>
  <p>I think that inserting data is too large and that caused an issue. Due to that I need to recreate it locally. For that, I want to decrease this timeout but I can't do it. What I already tried to do:</p>
  <p>First approach:</p>
  <pre><code>public AppDbContext() : base(&quot;AppDb&quot;)
          {
              _logger = LogManager.GetCurrentClassLogger();
              Database.CommandTimeout = 10; // normlany this is set to 180 but I want to avoid 
                                               large time for waiting for error so I set it to 
                                               10
          }
  </code></pre>
  <p>Second approach:</p>
  <p>I changed my connection string</p>
  <pre><code>Data Source=.\SQLEXPRESS;Initial Catalog=Application-DEV;Integrated Security=True;MultipleActiveResultSets=true;Connection Timeout=1
  </code></pre>
  <p>I also tried to make it this way:</p>
  <pre><code>using (var context = new AppDbContext())
              {
                  context.Database.CommandTimeout = 2;
                  var breakPointOne = 1;
  
                  context.FunctionalLocations.AddRange(data);
                  context.SaveChanges();
  
                  var breakPointTwo = 2;  // this breakpoint is reached after 50 seconds... 
              }
      // why exception isn't throwed?
  
  </code></pre>
  <p>anyone can tell me how to decrease this time? maybe I need to do something in db?</p>