I have this action for creating reports:
public ActionResult Report(string id) { LocalReport lr = new LocalReport(); string path = Path.Combine(Server.MapPath("~/Report"), "Person.rdlc"); if (System.IO.File.Exists(path)) { lr.ReportPath = path; } else { return View("Index"); } List<Person> cm = new List<Person>(); var viewModel = new PersonIndexData(); viewModel.People= db.Person .Include(k => k.Groups) .OrderBy(k => k.Name); cm = viewModel.People.ToList(); ReportDataSource rd = new ReportDataSource("PersonDataSet", cm); lr.DataSources.Add(rd); string reportType = id; string mimeType; string encoding; string fileNameExtension; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = lr.Render( reportType, null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); return File(renderedBytes, mimeType); }
When I call this action as follows: (mysite / person / report / pdf), I get this exception:
An error occurred while processing the report. Indication of this line:
renderedBytes = lr.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
Can you tell me why I get this exception in this code? This makes no mistake, and the exception is not very explainable. First I use the EF code. Thanks.
jason source share