首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >微软在Azure函数中报告LocalReport : ReportProcessingException

微软在Azure函数中报告LocalReport : ReportProcessingException
EN

Stack Overflow用户
提问于 2019-07-04 16:30:27
回答 1查看 373关注 0票数 1

我创建了一个基本的Azure函数 (.NET),我有一个生成LocalReport (基于WinForms)的基本项目。这可以在ASP.NET MVC应用程序和单元测试中工作,但不适用于Azure函数。

不完全是这样,但你有这样的想法:

代码语言:javascript
复制
[FunctionName("Report")]
public static async Task<HttpResponseMessage> Report([HttpTrigger(AuthorizationLevel.Function, "POST", Route = "Report")]HttpRequestMessage req, ILogger log)
{
    Microsoft.Reporting.WinForms.LocalReport lr = new Microsoft.Reporting.WinForms.LocalReport();
    lr.ReportPath = "Sales.rdlc";
    lr.DataSources.Add(new ReportDataSource("Sales", GetSalesData()));

    // this line fails:
    var bytes = lr.Render("PDF", null, out mimeType, out encoding, out streamids, out warnings);

    response.Content = new ByteArrayContent(bytes);
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");

    return await Task.FromResult(response);
}

执行lr.Render("PDF", ...)时,将引发以下错误:

代码语言:javascript
复制
Microsoft.Reporting.WinForms.LocalProcessingException
  HResult=0x80131500
  Message=An error occurred during local report processing.
  Source=Microsoft.ReportViewer.WinForms
  StackTrace:
   at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
   at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
   at Microsoft.Reporting.WinForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
   at Microsoft.Reporting.WinForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)

Inner Exception 1:
ReportProcessingException: Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.

我不太清楚缺少的程序集可能是什么,但是我的bin文件夹中有大量相关的程序集,包括:

  • Microsoft.ReportViewer.Common.dll
  • Microsoft.ReportViewer.Common.resources.dll
  • Microsoft.ReportViewer.DataVisualization.dll
  • Microsoft.ReportViewer.DataVisualization.resources.dll
  • Microsoft.ReportViewer.Design.dll
  • Microsoft.ReportViewer.Design.resources.dll
  • Microsoft.ReportViewer.ProcessingObjectModel.dll
  • Microsoft.ReportViewer.WinForms.dll
  • Microsoft.ReportViewer.WinForms.resources.dll
  • Microsoft.SqlServer.Types.dll
  • 还有更多..。

这是否与“沙箱”问题有关?如果是,为什么这个错误信息会如此误导?

有没有人在Azure函数中运行微软的本地报告?

EN

回答 1

Stack Overflow用户

发布于 2019-07-25 10:42:54

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56891704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档