简体   繁体   中英

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

I am using MVC(ASP.Net + C#) based application. I have used Jquery DataTable to display records. Now issue is that for some records its working good and for some records it's giving me error like "Timeout expired" at front end side.

I am using Entity Framework & Stored Procedure to fetch records. For some values It's giving me Timeout Error. If I directly executed this Sp with those require parameters (in which it's giving me Timeout Error) then it's working fine(but taking bit time around 11 seconds in SQL Server.). I just getting Timeout error frond end side.

I am getting below error.

{"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."} {"The wait operation timed out"}

I have tried added in web.config

  1. Connection Lifetime=120;
  2. Min Pool Size=120;
  3. Connection Timeout=300;
  4. Max Pool Size=1000;Pooling=true;
  5. <httpRuntime executionTimeout="180" maxRequestLength="2000000000" />

But didn't workout.

My Web.Config as below.

<add name="TestEntities" connectionString="metadata=res://*/Test2.csdl|res://*/Test2.ssdl|res://*/Test2.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=Test2;integrated security=True;multipleactiveresultsets=True;Connection Lifetime=120;Min Pool Size=120;Connection Timeout=300;Max Pool Size=1000;Pooling=true;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Please help.

Thanks -Nimesh

SQL server creates an execution plan for stored procedures to optimize the performance for further executions (parameter sniffing). When you execute this stored procedure on SSMS , it works fine but when you try to execute the same stored procedure from your ASP.NET MVC application, you'd face the timeout issue. You can fix this by re-creating/altering your stored procedure WITH RECOMPILE option (after your parameters). I faced this issue today; altered my stored procedure WITH RECOMPILE option and it worked like a charm. For more details, read about Parameter Sniffing .

我已经通过将 CommandTimeout 增加到 120 来解决问题

Db.CommandTimeout = 120;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question SQL Server Exception:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding ExecuteQueryin linq :Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding Linq Count() timing out -Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding Execute package in ssis causes Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. working on remote windows .net C# entityframework core throwing Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding 'Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM