title: Timeout expired. The timeout period elapsed prior to completion of the operation or the server. The wait operation timed out - strange behavoiur
body: <p>I know that in SO is lot of this kind of topics, but would like to introduce to my concrete example. </p>
  
  <p>When running action from web app (ADO.NET, ASP.NET MVC) getting error:
  <strong>Timeout expired. The timeout period elapsed prior to completion of the operation or the server. The wait operation timed out</strong></p>
  
  <p>But from the second hand when running directly on db raw query (captured by profiler) taking only 2 seconds.</p>
  
  <p><strong>Background:</strong></p>
  
  <ol>
  <li>Issue appear suddenly (week after release) and occurring only in prod server.</li>
  <li>Timeout for this specific query is 180 sec, for http requests is 24000 [units] - probably also seconds (per MSDN)</li>
  <li>We have no full text indexes</li>
  <li>Error occurring only for one specific query when user search by one "fretext" (normal textbox) field what generating the query 
  with additional 10-12 <strong>"or like %value%"</strong> conditions (the way how it was done from the begin, and have no chance to change it)</li>
  <li>What is strange very similar queries (for others "freetext" fields with the same amount of <strong>"or like %value%"</strong>) working without any problems</li>
  <li>Transaction isolation level = Serialized</li>
  <li>Data binding is done in the same way for each query (controller->service->db->service->view model->html), actually our 
  framework automatically binding fields from "select" query to viewModels</li>
  <li>Raw query (captured by profiler) running quickly (2-3 secounds) but from webApp level returning timeout.</li>
  <li>I have no direct access to prod server, so im not able to check everything immediately, also i can not share any code/stacktraces.</li>
  </ol>
  
  <p><strong>Advices:</strong></p>
  
  <p>Found lot similar posts, this one looks especially interesting for me: <a href="https://stackoverflow.com/a/8603111">https://stackoverflow.com/a/8603111</a>, and wondering about clearing statistics (exec sp_updatestats). </p>
  
  <p><strong>Question:</strong></p>
  
  <p>Do you have similar experiences, maybe any others advices as suggested above? What can be the reason that raw query running in short time, but from webapp getting timeout?</p>