.net - long running sql procedure hangs website -
i have mvc 4 web application calls business layer calls data layer method executesp
asynchronously. data layer method executesp calls long running stored procedure this:
public class maindatalayer { private database database; //enterprise library 5 private dbcommand dbc; private list<spparams> spparams; public maindatalayer() { _database = databasefactory.createdatabase("strconn"); //set multiple sp params 1 below _spparams.add(new spparams() { paramname = "@pid", paramvalue = id }); } public dataset executesp() { dbc = database.getstoredproccommand('long_running_sp'); dbc.commandtimeout = 300; foreach (spparams p in spparams) { dbc.parameters.add(new sqlparameter(p.paramname, p.paramvalue)); } dataset ds = _database.executedataset(dbc); return ds; } } //this class used in class above setting sp parameters public class spparams { public string paramname { get; set; } public object paramvalue { get; set; } }
the long running stored procedure has few inserts , few updates , final time out call below simulate long running process.
waitfor delay '0:02:00'
the problem is when call stored procedure thru web application deployed on test server client pc a, hangs further calls same client or other user calling webpage until 2 minutes in stored procedure have elapsed. when run stored procedure directly sql management studio , run sql statement side side, stored procedure takes 2 minutes execute , other sql statement executes immediately. doesnt there on database side need change. problem code?
thanks
Comments
Post a Comment