Question : Rendering timeout when calling report through C# code

The timeout on our SQL 2005 Reporting Services is set to 1800 seconds.  When I call the report through code by making an instance of the reporting service on my web page, it times out after like 45 seconds.

The code being used to render the report is:
    protected void BtnProcessOnDemand_Click(object sender, EventArgs e)
    {
        this.LblError.Visible = false;
        this.LblError.Text = "";
        //initialize variables
        String SITEID = "%";
        String DIVID = "%";
        String BENGROUPID = "%";
        DateTime PREMDATE = System.DateTime.Now;
        if (TxtRptPremDate.Text.Length > 0)
        {
            PREMDATE = Convert.ToDateTime(TxtRptPremDate.Text.ToString());
        }
        else
        {
            LblError.Text = "Please input a premium date.";
            LblError.Visible = true;
            return;
        }

        if (DdlSite.SelectedIndex != 0)
        {
            SITEID = DdlSite.SelectedValue;
            if (DdlDivision.SelectedIndex != 0)
            {
                DIVID = DdlDivision.SelectedValue;
                if (DdlBenGroup.SelectedIndex != 0)
                {
                    BENGROUPID = DdlBenGroup.SelectedValue;
                }
            }
        }

        //if (((Button)sender).CommandName.ToString() != LblHidden.Text)
        //{
            String error = "";
            ReportExecutionService RE = new ReportExecutionService();
            RE.Credentials = new System.Net.NetworkCredential("Username", "Password", "Domain");

            RE.Url = "http://report.ntlbenefit.com/reportserver/reportexecution2005.asmx?wsdl";

            // Render arguments
            DataSet pathdir = SC.get_path();

            DataSet report = SC.get_reportinfo(DdlReportsOD.SelectedValue.ToString());
            byte[] result = null;
            string reportPath = "/" + pathdir.Tables[0].Rows[0]["path_folder"].ToString() + "/" + report.Tables[0].Rows[0]["rpt_link"].ToString();
            string format = DdlFormat.SelectedValue.ToString();
            string historyID = null;
            string devInfo = @"Falser>Info>";
            // Prepare report parameter.
            ParameterValue[] parameters = new ParameterValue[5];
            parameters[0] = new ParameterValue();
            parameters[0].Name = "SITEID";
            parameters[0].Value = SITEID;
            parameters[1] = new ParameterValue();
            parameters[1].Name = "DIVID";
            parameters[1].Value = DIVID;
            parameters[2] = new ParameterValue();
            parameters[2].Name = "BENGROUPID";
            parameters[2].Value = BENGROUPID;
            parameters[3] = new ParameterValue();
            parameters[3].Name = "PREMDATE";
            parameters[3].Value = PREMDATE.ToString();
            parameters[4] = new ParameterValue();
            parameters[4].Name = "ADMINID";
            parameters[4].Value = Session["AdminID"].ToString();
            //LblError.Text = reportPath;
            //LblError.Visible = true;
            //return;
            DataSourceCredentials[] credentials = null;
            string showHideToggle = null;
            string encoding;
            string mimeType;
            string extension;
            string actualextension;
            actualextension = DdlFormat.SelectedValue.ToString();
            Warning[] warnings = null;
            ParameterValue[] reportHistoryParameters = null;
            string[] streamIDs = null;

            ExecutionInfo execInfo = new ExecutionInfo();
            ExecutionHeader execHeader = new ExecutionHeader();

            RE.ExecutionHeaderValue = execHeader;
            try
            {
                execInfo = RE.LoadReport(reportPath, historyID);
            }
            catch (Exception eload)
            {
                this.LblError.Text = "The requested report is not available, please check back soon.";
                this.LblError.Visible = true;
                return;
            }
            RE.SetExecutionParameters(parameters, "en-us");
            String SessionId = RE.ExecutionHeaderValue.ExecutionID;

            try
            {
                result = RE.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
            }
            catch (SoapException soape)
            {
                error = soape.ToString() + "";
            }
            // Write the contents of the report to an MHTML file.
       
           
            try
            {
                String guid = Guid.NewGuid().ToString();
                FileStream stream = File.Create(Server.MapPath("~/Temp/" + guid + "." + actualextension), result.Length);
                stream.Write(result, 0, result.Length);
                stream.Close();
                LblHidden.Text = report.Tables[0].Rows[0]["rpt_link"].ToString();
                //this.PnlConfirm.Visible = true;
                LblDisplay.Text = "";
            }
            catch (Exception ex)
            {
                error = ex.ToString() + "";
            }

            if (error.Length > 0)
            {
                this.LblError.Text = error.ToString();
                this.LblError.Visible = true;
            }
        //}
    }

When developing a sql statement in my webservice I can set how long it takes to time out the connection.  Is there a similar function when rendering from a page.  Some of these reports take 10 to 15 minutes to generate.  

Any help would be greatly appreciated.

Answer : Rendering timeout when calling report through C# code

can think of couple of suggestions:
-make sure the timeout value is in seconds and not milliseconds
-make sure the sql statement is not timing out...
Random Solutions  
 
programming4us programming4us