Note that there are some explanatory texts on larger screens.

plurals
  1. POlong running sql procedure hangs website
    primarykey
    data
    text
    <p>I have an MVC 4 web application that calls the business layer which calls a data layer method <code>ExecuteSP</code> asynchronously. The data layer method ExecuteSP calls a long running stored procedure like this:</p> <pre><code>public class MainDataLayer { private Database database; //Enterprise library 5 private DbCommand dbc; private List&lt;SPParams&gt; spParams; public MainDataLayer() { _database = DatabaseFactory.CreateDatabase("strConn"); //set multiple sp params like the one 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 is used in the class above for setting the sp parameters public class SPParams { public string ParamName { get; set; } public object ParamValue { get; set; } } </code></pre> <p>The long running stored procedure has a few inserts and a few updates and the final time out call as below to simulate a long running process.</p> <pre><code>WAITFOR DELAY '0:02:00' </code></pre> <p><strong>The problem is</strong> when I call this stored procedure thru my web application deployed on my test server from client pc A, it hangs all further calls from the same client or any other user calling the webpage until the 2 minutes in the stored procedure have elapsed. When I run the stored procedure directly from sql management studio and run another sql statement side by side, the stored procedure takes 2 minutes to execute and the other sql statement executes immediately. It doesnt look like there is something on the database side that I need to change. What could be the problem with my code?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload