3
votes

I'm migrating simple ASP Web API to Azure Functions, for the first time. The function will take some JSON input, and creates a PDF report with Microsoft.Reporting.WebForms.

Unfortunatly, I get the following error:

Exception while executing function: Functions.HttpTriggerCSharp1. Microsoft.ReportViewer.WebForms: An error occurred during local report processing. Microsoft.ReportViewer.Common: The definition of the report 'D:\home\site\wwwroot\HttpTriggerCSharp1\bin\Test.rdlc' is invalid. Microsoft.ReportViewer.Common: An unexpected error occurred in Report Processing. Microsoft.ReportViewer.Common: The type initializer for 'Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion' threw an exception. mscorlib: The path is not of a legal form.

First I thought that the .rdlc file was not found, but that doens't seems to be the case. It finds the file, but can't handle it, so it seems.

I'm calling the file via:

ReportViewer rv = new ReportViewer();
rv.ProcessingMode = ProcessingMode.Local;
rv.LocalReport.ReportPath = Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), @"site\wwwroot\HttpTriggerCSharp1\bin\Test.rdlc");

I've searched a lot, but can't find specifics on Azure Functions and ReportViewer. Maybe I'm missing something, or I'm trying something that's not possible. Thanks in advance.

1
Note familiar with ReportViewer but it is possible that you are hitting a Sandbox issue. See: github.com/projectkudu/kudu/wiki/… - Ling Toh
Quote from the site mentioned: The following PDF generators are supported: SQL Reporting framework: requires the site to run in Basic or higher. - TJ_
@LingToh Is there maybe someone in the Azure-Functions teams, who could help me? - TJ_
Is your Function running on an App Service or Consumption Plan? - Ling Toh
It's running on an App Service, Basic Plan. - TJ_

1 Answers

1
votes

From the Azure official document, we could know that ProcessingMode.Local is not supported in the Microsoft Azure.

ReportViewer configured in local processing mode is not supported in Microsoft Azure

The following is the snippet of document, more details please refer to the document.

To incorporate ReportViewer into your Microsoft Azure Web site, you need to complete the following tasks.

  • Add Assemblies to the Deployment Package
  • Configure Authentication and Authorization
  • Publish the ASP.NET Web application to Azure

Update:

According to the link, currently, this library does work with Web Sites and WebJobs, but not with Functions due to the nature of how we load assemblies.