Time Out Error in ASP.Net

Sayanthan picture Sayanthan · Oct 12, 2011 · Viewed 9.5k times · Source

How can I stop time out error for executing SQL query in ASP.Net? I researched in Google but I couldn't solve my problem correctly.

Answer

kst picture kst · Oct 12, 2011

I think your problem is about CommandTimeOut.The time (in seconds) to wait for the command to execute. The default is 30 seconds. Here is full example. Otherwise, you should set the ConnectionTimeOut in your database connection string. Something like that

<add key="ConnString2" value="Provider=SQLOLEDB;User Id=sa;PASSWORD=1;
SERVER=BlurBlur;database=BlurBlur;Connect Timeout=60;"/>

If you use the UpdatePanel, set the AsyncPostBackTimeout.

<asp:ScriptManager ID="ScriptManager1" runat="server" 
AsyncPostBackTimeout ="360000"></asp:ScriptManager>

to be more sure

<httpRuntime executionTimeout="360000"/>