Azure functions Microsoft报告Azure中的LocalReport函数:ReportProcessingException

Azure functions Microsoft报告Azure中的LocalReport函数:ReportProcessingException,azure-functions,ms-reports,Azure Functions,Ms Reports,我创建了一个基本(.NET),我有一个基本项目,它生成一个(基于WinForms的)。这适用于ASP.NET MVC应用程序和单元测试,但不适用于Azure函数 不完全是这样,但你知道了: [FunctionName("Report")] public static async Task<HttpResponseMessage> Report([HttpTrigger(AuthorizationLevel.Function, "POST", Route = "Report")]Htt

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

不完全是这样,但你知道了:

[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);
}
我不知道丢失的程序集可能是什么,但我的
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功能中运行Microsoft本地报告吗?

是的,这是由于沙箱限制

是的,这是由于沙箱限制

我觉得这份文件对此不是很清楚,尤其是计划。我运行在“免费”层(S1)之上,我认为它可能会工作。另外,有趣的是,它作为一个WebJob(应用程序内服务)工作。我觉得这个文档对此不是很清楚,尤其是计划。我运行在“免费”层(S1)之上,我认为它可能会工作。此外,有趣的是,它作为一个WebJob(应用程序内服务)工作
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.