I'm trying to generate a simple report based on this article : www.dotnetawesome.blogspot.com/2013/09/microsoft-report-in-mvc-4.html[^] Here is my controller
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 cm = new List();
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;
string deviceInfo =
"" +
" " + id + "" +
" 8.5in" +
" 11in" +
" 0.5in" +
" 1in" +
" 1in" +
" 0.5in" +
"";
Warning\[\] warnings;
string\[\] streams;
byte\[\] renderedBytes;
renderedBytes = lr.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
When I type (mysite/person/report/pdf), I get this exception : An error occurred during report processing. At this part :
renderedBytes = lr.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out wa