Search code examples
c#azurereportingwebjoblocalreport

LocalReport rendering in an Azure Web Job


I have an MVC web application running in Azure. We are using instances of Microsoft.Reporting.WebForms.LocalReport to run reports against the database that the web application is using. Some of the data sets are very large and rendering can take a very long time. So we decided to offload the rendering of the reports into a separate App Service as a Web Job. The application runs correctly in my development environment, but when it is uploaded as a web job, it crashes with the following exception in the web job logs:

[10/30/2017 17:16:48 > 81a023: ERR ] Unhandled Exception: Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report '' is invalid. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion' threw an exception. ---> System.ArgumentException: The path is not of a legal form.
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.IO.Path.GetFullPathInternal(String path)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.IO.Path.GetFullPath(String path)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String fileName)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
[10/30/2017 17:16:48 > 81a023: ERR ]    at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion.<>c__DisplayClass1.<.cctor>b__0()
[10/30/2017 17:16:48 > 81a023: ERR ]    at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.<>c__DisplayClass1.<Run>b__0(Object state)
[10/30/2017 17:16:48 > 81a023: ERR ]    at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
[10/30/2017 17:16:48 > 81a023: ERR ]    at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback)
[10/30/2017 17:16:48 > 81a023: ERR ]    at Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion..cctor()

The error is thrown when the LocalReport.Render() method is called.

The report definitions are read from a table in the database so that nothing needs to be re-compiled or re-published if a change needs to be made to the report.

My question is, why is this happening and how do I fix it?

Thanks in advance.


Solution

  • unhandled Exception: Microsoft.Reporting.WinForms.LocalProcessingException:

    According to Azure official document, reportViewer configured in local processing mode is not supported in Microsoft Azure.

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

    My question is, why is this happening and how do I fix it?

    As Azure WebApp is a sandbox, if Cloudservice is acceptable, please have try to use Cloudservice. About how to Migrate and Publish a Web Application to an Azure Cloud Service from Visual Studio, we could refer to this document.