Reputation: 121
I am having the following issue with my rdlc reports. I am creating an asp.net MVC application and need to use reports. All my reports work fine on my local machine, but on azure website I get the always this error:
Error.
An error occurred while processing your request.
On my azure bin folder I have the following dll's
Microsoft.ReportViewer.Common
Microsoft.ReportViewer.DataVisualization
Microsoft.ReportViewer.ProcessingObjectModel
Microsoft.ReportViewer.WebForms
Microsoft.ReportViewer.WinForms
and have a folder Reports with all my reports in it.
I also have change my reports properties Build Action to content and still nothing. Does any one know how can I resolve this issue.
The code that I am using and works fine on my localhost
LocalReport lr = new LocalReport();
string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "Model1.rdlc");
if (System.IO.File.Exists(path))
{
lr.ReportPath = path;
}
else
{
return View();
}
ReportDataSource rd = new ReportDataSource("Model1");
lr.DataSources.Add(rd);
string reportType = id;
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>" + id + "</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.2in</MarginTop>" +
" <MarginLeft>0.1in</MarginLeft>" +
" <MarginRight>0.1in</MarginRight>" +
" <MarginBottom>0.3in</MarginBottom>" +
" <orientation>Landscape</orientation>" +
"</DeviceInfo>";
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);
Upvotes: 1
Views: 1482
Reputation: 1820
Azure App Service Apps run in a secure environment called a sandbox to isolate apps. This sandbox is blocking various APIs calls, like GDI+ APIs. The problem might come from this limitation. Please see the following documentation page for more détails: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox
Upvotes: 3