T
tequila00shots
Hello,
I have code that calls a long running stored procedure from a web page
button. After the first exec statement is called and finishes (about
45 minutes) the other exec statements do not run. I do not care what
happens to the web page after the user clicks the button, but I need
the stored procedure to finish. Is there any way I can make it
happen?
Below is the code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection cnVmwareBackup = new SqlConnection
("server=localhost;integrated
security=true;database=vmwareBackup;async=true");
SqlCommand cmdCopy = new SqlCommand("dbo.copyCA",
cnVmwareBackup);
cmdCopy.CommandTimeout = 4200;
cmdCopy.CommandType =
CommandType.StoredProcedure;
Session.Timeout = 4200;
Server.ScriptTimeout = 4200;
//cnVmwareBackup.ConnectionTimeout = 4200;
cnVmwareBackup.Open();
cmdCopy.BeginExecuteNonQuery();
Button1.Text = "You may close the web page";
//cmdCopy.EndExecuteNonQuery();
//cmdCopy.ExecuteNonQuery();
//cnVmwareBackup.Close();
}
catch
{
Button1.Text = "Failed - Please check the server
logs.";
}
I have code that calls a long running stored procedure from a web page
button. After the first exec statement is called and finishes (about
45 minutes) the other exec statements do not run. I do not care what
happens to the web page after the user clicks the button, but I need
the stored procedure to finish. Is there any way I can make it
happen?
Below is the code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection cnVmwareBackup = new SqlConnection
("server=localhost;integrated
security=true;database=vmwareBackup;async=true");
SqlCommand cmdCopy = new SqlCommand("dbo.copyCA",
cnVmwareBackup);
cmdCopy.CommandTimeout = 4200;
cmdCopy.CommandType =
CommandType.StoredProcedure;
Session.Timeout = 4200;
Server.ScriptTimeout = 4200;
//cnVmwareBackup.ConnectionTimeout = 4200;
cnVmwareBackup.Open();
cmdCopy.BeginExecuteNonQuery();
Button1.Text = "You may close the web page";
//cmdCopy.EndExecuteNonQuery();
//cmdCopy.ExecuteNonQuery();
//cnVmwareBackup.Close();
}
catch
{
Button1.Text = "Failed - Please check the server
logs.";
}