LocalReport 在 Azure Web 作业中呈现

LocalReport rendering in an Azure Web Job

我在 Azure 中有一个 MVC Web 应用程序 运行ning。我们正在使用 Microsoft.Reporting.WebForms.LocalReport 到 运行 报告的实例来针对 Web 应用程序正在使用的数据库。一些数据集非常大,渲染可能需要很长时间。因此,我们决定将报告的呈现作为 Web 作业卸载到单独的应用服务中。应用程序 运行 在我的开发环境中正确运行,但当它作为 Web 作业上传时,它崩溃并在 Web 作业日志中出现以下异常:

[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()

调用LocalReport.Render()方法时报错

报告定义是从数据库中的 table 中读取的,因此如果需要对报告进行更改,则无需重新编译或重新发布。

我的问题是,为什么会发生这种情况,我该如何解决?

提前致谢。

unhandled Exception: Microsoft.Reporting.WinForms.LocalProcessingException:

根据 Azure official document,Microsoft Azure 不支持在本地处理模式下配置的 reportViewer。

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?

因为 Azure WebApp 是 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