locked
Microsoft.ReportViewer.WebForms An error occurred during local report processing RRS feed

  • Question

  • User-960459514 posted

    Hi All,

    {I had this posted on social.microsoft.com but was told to try posting it here to see if someone can help}

    I use Microsoft.ReportViewer.WebForms to create pdf files from an rdlc file. All of this works fine. However, we notice that every week or two we start to get the following error: "An error occurred during local report processing". This continues until we restart our web app (in azure). If we do not restart the web app, the web app will eventually become non responsive. So, I assume there is a memory issue or something similar. But we do not know how to fix it. This happens on multiple servers. We have also tried cloud services in azure and it happens there too. So there is something with this library. We actually have diffferent web apps with different versions of the same library and the same problem exists. So maybe we are doing something wrong int he code. Here is our code, maybe someone can help. Thank You, David

    int CurrencyId = WJNCurrency.GetSystemCurrency(CompanyId).CurrencyId;
    
                ReportViewer reportViewer = new ReportViewer();
    
                reportViewer.Height = System.Web.UI.WebControls.Unit.Parse("100%");
                reportViewer.Width = System.Web.UI.WebControls.Unit.Parse("100%");
    
                reportViewer.LocalReport.DataSources.Clear();
    
                reportViewer.ProcessingMode = ProcessingMode.Local;
    
                var assembly = System.Reflection.Assembly.GetExecutingAssembly();
    
                WJNReservation rv = WJNReservation.Get(ReservationId);
    
                reportViewer.LocalReport.ReportEmbeddedResource = "MTier.Reports.BookingPDFByReservationId.rdlc";
    
                reportViewer.LocalReport.EnableExternalImages = true;
    
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1",
                     WJNPDFBookingConfirmation.GetPassengersAndPassesByReservationId(ReservationId).Tables[0]));
    
                DataTable TotalPriceDataTable = new DataTable();
                TotalPriceDataTable.Clear();
                TotalPriceDataTable.Columns.Add("TotalCardServiceFee");
                TotalPriceDataTable.Columns.Add("TotalPrice");
                TotalPriceDataTable.Columns.Add("TotalPaid");
                TotalPriceDataTable.Columns.Add("TotalDue");
    
                DataRow TotalPriceDataRow = TotalPriceDataTable.NewRow();
                TotalPriceDataRow["TotalCardServiceFee"] = WJNReservation.GetTotalCardFeeByReservationId(ReservationId, CurrencyId).ToString("0.00");
                TotalPriceDataRow["TotalPrice"] = WJNReservation.GetTotalToPayByReservationId(ReservationId, CurrencyId, 100).ToString("0.00");
                TotalPriceDataRow["TotalPaid"] = WJNReservation.GetTotalPaidByReservationId(ReservationId, CurrencyId).ToString("0.00");
                TotalPriceDataRow["TotalDue"] = WJNReservation.GetTotalDueByReservationId(ReservationId, CurrencyId).ToString("0.00");
                TotalPriceDataTable.Rows.Add(TotalPriceDataRow);
    
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet7",
                                                                    TotalPriceDataTable));
    
                reportViewer.LocalReport.Refresh();
                Warning[] warnings;
                string[] streamids;
                string mimeType;
                string encoding;
                string extension;
    
                string deviceInfo =
               "<DeviceInfo>" +
               "  <EmbedFonts>None</EmbedFonts>" +
               "</DeviceInfo>";
    
                //this is array bytes that you need
                byte[] bytes = reportViewer.LocalReport.Render(
                                   "PDF", deviceInfo, out mimeType, out encoding,
                                    out extension,
                                   out streamids, out warnings);
    
    
    
                return bytes;

    Thursday, October 11, 2018 4:24 PM

All replies