Out of memory errors in StiWebViewerFx

Stimulsoft Reports.WEB discussion
Post Reply
Lynn
Posts: 42
Joined: Tue Oct 06, 2009 9:58 am
Location: United States

Out of memory errors in StiWebViewerFx

Post by Lynn »

We are using the following code (in OnPreRender) to display a .mdc file in the viewer:

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;
                }
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?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Out of memory errors in StiWebViewerFx

Post by Jan »

Hello,

Can you send sample project to support@stimulsoft.com ? How many pages you receive in standalone report designer when preview report?

Thank you.
Post Reply