生成RDLC报表时超时怎么办?
我用VS2005作了一个Web程序,有一个页面可以生成一个RDLC报表.
报表的数据源是一个自定义Object DBD的IList:
private IList<DBD> dbds
{
get { return Session["TestDBDReport_Page_dbds"] as IList<DBD>; }
set { Session["TestDBDReport_Page_dbds"] = value; }
}
class DBD 有100多个字段,10000多行数据.
我在Button1的Click事件中,从数据库中读取数据,耗时40秒左右:
dbds = MapperRegister.singleton.DBD.findAll();
在Button2的Click事件中,把dbds赋给报表,并生成报表:
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/service/report/DBD_Report.rdlc");
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DBD", dbds));
ReportViewer1.DataBind();
结果大约2分钟后,出现"请求已超时"的错误信息,页面下放的"堆栈跟踪"栏写着"[HttpException (0x80004005): 请求已超时。]"
我已经把Session超时时间设成了12000了,可是还是不行,请问各位大侠我该怎么办呀?
后来我把ReportViewer1的ShowReportBody属性设为False,即不让ReportViewer1显示,想通过后台代码直接导出Excel:
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/service/report/DBD_Report.rdlc");
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DBD", dbds));
ReportViewer1.DataBind();
Microsoft.Reporting.WebForms.Warning[] Warnings;
string[] strStreamIds;
string strMimeType;
string strEncoding;
string strFileNameExtension;
byte[] bytes = ReportViewer1.LocalReport.Render("Excel", null, out strMimeType, out strEncoding, out strFileNameExtension, out strStreamIds, out Warnings);
string strFilePath = @"D:\report.xls";
using (System.IO.FileStream fs = new System.IO.FileStream(strFilePath, System.IO.FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
结果还是出现"请求已超时"的错误信息