Out of memory errors in StiWebViewerFx
Posted: Thu Oct 22, 2009 6:07 am
We are using the following code (in OnPreRender) to display a .mdc file in the viewer:
When the report file is approx 16 MB or larger, we get an exception of type 'System.OutOfMemoryException'.
Stack Trace: at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength) at System.Text.StringBuilder.Append(Char[] value, Int32 startIndex, Int32 charCount) at System.IO.StreamReader.ReadToEnd() at Stimulsoft.Report.StiReport.SaveDocumentToString() at Stimulsoft.Report.StiReport.SavePackedDocumentToString() at Stimulsoft.Report.WebFx.StiWebViewerFx.ProcessReport() at Stimulsoft.Report.WebFx.StiWebViewerFx.set_Report(StiReport value) at Mercer.ePRISM.Web.UI.analysis.ReportViewerPopup.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Is there some other way of loading large report files into the viewer that will avoid the out of memory issue?
Code: Select all
Stream reportFile = null;
if (Request.QueryString["FileID"] != null)
reportFile = ePrismFileManagerServiceHelper.GetFileStream(Convert.ToInt64(Request.QueryString["FileID"].ToString()));
else if (Request.QueryString["FileName"] != null)
reportFile = ePrismFileManagerServiceHelper.GetFileStream(Request.QueryString["FileName"]);
if (reportFile != null)
{
byte[] tempBuffer = new byte[reportFile.Length - reportFile.Position];
reportFile.Read(tempBuffer, (int)reportFile.Position, (int)(reportFile.Length - reportFile.Position));
MemoryStream stream = new MemoryStream(tempBuffer);
StiReport reportOutput = new StiReport();
reportOutput.LoadDocument(stream);
StiWebViewerFxOptions.Connection.RelativeUrls = true;
StiWebViewer1.Report = reportOutput;
StiWebViewer1.CacheMode = StiWebViewerFx.StiCacheMode.Session;
}
Stack Trace: at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity) at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength) at System.Text.StringBuilder.Append(Char[] value, Int32 startIndex, Int32 charCount) at System.IO.StreamReader.ReadToEnd() at Stimulsoft.Report.StiReport.SaveDocumentToString() at Stimulsoft.Report.StiReport.SavePackedDocumentToString() at Stimulsoft.Report.WebFx.StiWebViewerFx.ProcessReport() at Stimulsoft.Report.WebFx.StiWebViewerFx.set_Report(StiReport value) at Mercer.ePRISM.Web.UI.analysis.ReportViewerPopup.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Is there some other way of loading large report files into the viewer that will avoid the out of memory issue?