Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application, I am generating a bill and printing as PDF using RDLC report. And showing the error "Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report 'E:\NetDocs\digital_coirboard\FundAllocation\RDLC\GenerateBill.rdlc' is invalid. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Pr"

But it works fine in our local servers and localhost.

What I have tried:

IEnumerable<FundAllocationOffice.Models.ActionPlanVm> Expenditure = oHOA.GetExpenditure_Detatils();
                               IEnumerable<FundAllocationOffice.Models.HOA_BillDetailsModel> Bill = oHOA.GetHoABill_Details();
                               IEnumerable<FundAllocationOffice.Models.Exp_ScheduleModel> letchure = oHOA.Exp_Schedule_Details();
                               IEnumerable<FundAllocationOffice.Models.Exp_PayeeModel> PayeeDetails = oHOA.Exp_Payee_DetailsForReport();
                               IEnumerable<FundAllocationOffice.Models.Exp_Bill_Details> BillDetails = oHOA.Exp_Bill_DetailsForReport();
                               IEnumerable<FundAllocationOffice.Models.Exp_Bill_Details> EFileDetails = oHOA.Exp_Efile_Details();




                               LocalReport localReport = new LocalReport();
                               //localReport.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));
                               localReport.ReportPath = Server.MapPath("~/RDLC/GenerateBill.rdlc");

                               ReportDataSource reportDataSource = new ReportDataSource("GetExpenditure", Expenditure);
                               localReport.DataSources.Add(reportDataSource);

                               ReportDataSource reportDataSource2 = new ReportDataSource("GetHoABill_Details", Bill);
                               localReport.DataSources.Add(reportDataSource2);

                               ReportDataSource reportDataSource3 = new ReportDataSource("Exp_Schedule_Details", letchure);
                               localReport.DataSources.Add(reportDataSource3);

                               ReportDataSource reportDataSource4 = new ReportDataSource("Exp_Payee_DetailsForReport", PayeeDetails);
                               localReport.DataSources.Add(reportDataSource4);

                               ReportDataSource reportDataSource5 = new ReportDataSource("Exp_Bill_Details_Report", BillDetails);
                               localReport.DataSources.Add(reportDataSource5);

                               ReportDataSource reportDataSource6 = new ReportDataSource("Exp_GenerateEoffice_PDF", EFileDetails);
                               localReport.DataSources.Add(reportDataSource6);




                               string reportType = "PDF";
                               string mimeType;
                               string encoding;
                               string fileNameExtension;

                               //////////////////
                               clsActivity.action = HttpUtility.HtmlEncode("GenerateBill_Report Event");
                               clsActivity.error_details = HttpUtility.HtmlEncode("22222");
                               clsActivity.page_Name = HttpUtility.HtmlEncode("Master/GenerateBill_Report");
                               insert_coir_error_log();
                               //////////////////

                               //The DeviceInfo settings should be changed based on the reportType
                               //http://msdn.microsoft.com/en-us/library/ms155397.aspx
                               string deviceinfo;
                               deviceinfo = "<DeviceInfo>" +
                                               "<OutputFormat>PDF</OutputFormat>" +
                                               "<PageWidth>11in</PageWidth>" +
                                               "<PageHeight>8.69in</PageHeight>" +
                                               "<MarginTop>0.5in</MarginTop>" +
                                               "<MarginLeft>0.2in</MarginLeft>" +
                                               "<MarginRight>0.2in</MarginRight>" +
                                               "<MarginBottom>0.5in</MarginBottom>" +
                                               "<Magnification>100%</Magnification>" +
                                               "</DeviceInfo>";

                               //////////////////
                               clsActivity.action = HttpUtility.HtmlEncode("GenerateBill_Report Event");
                               clsActivity.error_details = HttpUtility.HtmlEncode("33333");
                               clsActivity.page_Name = HttpUtility.HtmlEncode("Master/GenerateBill_Report");
                               insert_coir_error_log();
                               //////////////////

                               Warning[] warnings;
                               string[] streams;
                               byte[] renderedBytes;
                               string extension = string.Empty;

                               //////////////////
                               clsActivity.action = HttpUtility.HtmlEncode("GenerateBill_Report Event");
                               clsActivity.error_details = HttpUtility.HtmlEncode(deviceinfo);
                               clsActivity.page_Name = HttpUtility.HtmlEncode("Master/GenerateBill_Report");
                               insert_coir_error_log();
                               //////////////////

                               //Render the report
                               renderedBytes = localReport.Render(
                                   reportType,
                                   deviceinfo,
                                   out mimeType,
                                   out encoding,
                                   out fileNameExtension,
                                   out streams,
                                   out warnings);

                               //////////////////
                               clsActivity.action = HttpUtility.HtmlEncode("GenerateBill_Report Event");
                               clsActivity.error_details = HttpUtility.HtmlEncode("55555");
                               clsActivity.page_Name = HttpUtility.HtmlEncode("Master/GenerateBill_Report");
                               insert_coir_error_log();
                               //////////////////

                               Response.Buffer = true;
                               Response.Clear();
                               Response.ContentType = mimeType;
                               Response.AddHeader(
                               "content-disposition",
                               "attachment; filename= Bill" + oHOA.Expid + "." + fileNameExtension);
                               Response.OutputStream.Write(renderedBytes, 0, renderedBytes.Length); // create the file
                               Response.Flush(); // send it to the client to download
                               Response.End();
                               Session["Exp_ID"] = null;

                               //////////////////
                               clsActivity.action = HttpUtility.HtmlEncode("GenerateBill_Report Event");
                               clsActivity.error_details = HttpUtility.HtmlEncode("66666");
                               clsActivity.page_Name = HttpUtility.HtmlEncode("Master/GenerateBill_Report");
                               insert_coir_error_log();
                               //////////////////

                               return File(renderedBytes, mimeType);
Posted
Updated 17-Jun-19 22:25pm
v2
Comments
AdamASPGeek 16-Jul-19 1:00am    
It seems you are using crystal report? Is that correct? If yes, you need to make sure that your current provider support crystal report. If not, your application won't work. If you are using crystal report, I recommend you can take a look at asphostportal.com hosting plan. They fully support it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900