0

My stored procedure takes 42 seconds to execute . My web application gets timeout after 30 seconds. i have added:

< httpRuntime targetFramework="4.5.1" maxRequestLength="157286400"   
  executionTimeout="36000" />

in my system.web in web.config file. I also added Connect Timeout = 300000 in my connection string of the web.config.

enter image description here

But none of the solutions works for me. I tried to clear the SQL Server deadlock by executing below commands :

exec sp_updatestats

dbcc freeproccache
jarlh
  • 42,561
  • 8
  • 45
  • 63
Atibur Rahman
  • 101
  • 1
  • 9
  • You need to make sure that Is your server giving you timeout while executing store procedure or your HTTP request is timeout? – Saadi Apr 05 '18 at 07:27
  • did you try to increment commandTimeout for Stored procedure? – user9405863 Apr 05 '18 at 07:28
  • How may i know is it timeout in SP or HTTP request? – Atibur Rahman Apr 05 '18 at 07:30
  • i did not added commandtimeout in my SP – Atibur Rahman Apr 05 '18 at 07:31
  • 1
    Remember that .NET has a different execution plan than SSMS for the same Stored Procedure. Have you tried setting the timeout in your Model.Context.cs? Try doing this, https://stackoverflow.com/questions/10549640/how-to-set-commandtimeout-for-dbcontext – mvisser Apr 05 '18 at 08:25
  • Great ..... I just tried it....It worked..... Thank you very much.... – Atibur Rahman Apr 05 '18 at 08:40
  • Instead of hiding the problem by changing the timeout duration you should consider fixing the problem which is that your procedure is too slow. 42 seconds is an absurdly long time for a stored procedure to be running. – Sean Lange Apr 05 '18 at 10:47
  • It's a nested SP. I have to execute another SP inside the Sp. That's why it takes time. Also the calculation in both sp's take some time. – Atibur Rahman Apr 18 '18 at 07:58

0 Answers0