I'm working with webforms and generating a report in the reportviewer locally, the report accepts parameters and has a dataset
// Parametros
List<ReportParameter> parametersReport = new List<ReportParameter>();
parametersReport.Add(new ReportParameter("Nome", "Nome Teste TI"));
parametersReport.Add(new ReportParameter("Idade", "25"));
// DataSet
RecursoDeGlosaDataSet recursoDataSet = new RecursoDeGlosaDataSet();
// recursosFinalizados **vem do banco
recursosFinalizados.ToList().ForEach(y =>
{
recursoDataSet.Recurso.AddRecursoRow(
y.DataInicioRealizacao.ToString("dd/MM/yyyy"),
y.DataFim.Value.ToString("dd/MM/yyyy"),
y.CodigoTabela,
y.CodigoProcedimento,
y.DescricaoProcedimento,
y.GrauParticipacao,
y.CodigoItem,
y.ValorRecursado.ToString(),
y.Justificativaitem,
y.ValorAcatado.ToString(),
y.JustificativaCliente);
});
ReportViewer ReportViewer = new ReportViewer();
ReportViewer.ProcessingMode = ProcessingMode.Local;
eportViewer.LocalReport.ReportPath = "caminhoDoRelatorio"; // o caminho está ok
ReportViewer.LocalReport.DataSources.Add(
new Microsoft.Reporting.WebForms.ReportDataSource("RecursoDeGlosaDataSet",
(System.Data.DataTable)recursoDataSet.RecursoGlosa));
ReportViewer.LocalReport.SetParameters(parametersReport);
string mimeType = "";
string encoding = "";
string filenameExtension = "";
string[] streams = null;
Microsoft.Reporting.WebForms.Warning[] warnings = null;
string theDeviceSettings = "<DeviceInfo>
<HumanReadablePDF>True</HumanReadablePDF></DeviceInfo>";
byte[] bytes = ReportViewer.LocalReport.Render("PDF", theDeviceSettings,
out mimeType, out encoding, out filenameExtension, out streams, out
warnings);
Now I go to the error: report runs perfectly on my machine but when putting in PRODUCTION fell into the following error:
Ocorreu um erro durante o processamento de relatórios local.
at Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() at
Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable'1
parameters)
* Note: I installed the reportviewer through nuget, so the following dlls are in production (Install-Package Microsoft.Report.Viewer -Version 11.0.0)
- Microsoft.ReportViewer.Common.dll
- Microsoft.ReportViewer.ProcessingObjectModel.dll
- Microsoft.ReportViewer.WebForms.dll