Page 1 of 1

Out of memory errors in StiWebViewerFx

Posted: Thu Oct 22, 2009 6:07 am
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?

Out of memory errors in StiWebViewerFx

Posted: Sat Oct 24, 2009 12:56 am
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.