0
{
DataSet obj= new DataSet();
                SqlParameter[] sqlParams = new SqlParameter[2];
                sqlParams[0] = new SqlParameter("@val", SqlDbType.Int);
                sqlParams[0].Value = val;
                sqlParams[1] = new SqlParameter("@val1", SqlDbType.Int);
                sqlParams[1].Value = val1;


                return DataAccessHelper.DataAccessHelper.SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, "sp", sqlParams);

}

i have set connection timeout in web config and i can't use command timeout in c# ,am not using sqlcommand .my code stored procedure is taking around 2 mins so am getting this error.please suggest me to solve this issue

ascii
  • 64
  • 6
  • Does this happen in case of other stored procs also? How long does it take if you directly execute the stored proc from Management Studio? – shree.pat18 Dec 18 '13 at 06:54
  • no, only on the call of this sp.it takes nearly 2mins – ascii Dec 18 '13 at 06:58
  • @user3051282 Hi "connection" in ExecuteDataset method is connection object or connection string, in both cases you can set connection timeout and set it. – Manoj Mevada Dec 18 '13 at 11:15
  • hi manoj ,i have already set that in webconfig, so when i debuged my code i found the connection timeout . i have set it in webconfig connection timeout = 1500, but still am facing the sane error – ascii Dec 20 '13 at 11:55

1 Answers1

0

This is a try for help, I am not absolutely sure if this is the real issue, or a very bad database design and or bad query request.

If your query takes 2min, you may have felt on the session lock and other page request simple gets time out...

What I mean. The session (when you use it) is lock every page action for each user. Now if a user block the page for 2 min, every other request takes 2+2 min to complete, and so on... and eventually you have time outs.

Disable the session for this part of calculations, or send it to background thread and just show the results, or make better sql query...

Some more to read:
ASP.NET Server does not process pages asynchronously
Web app blocked while processing another web app on sharing same session

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150