小编Dis*_*rno的帖子

502 错误:使用 IronPDF 的 Azure 应用服务上的网关错误

我正在尝试让 IronPDF 参与我的 ASP.NET Core 3.1 应用服务部署。我没有使用 Azure Functions 来实现这些目的,而只是使用 Azure 应用服务上的常规端点 - 当用户调用它时,该服务会生成并返回生成的 PDF 文档。

在本地主机上运行端点时,它可以完美地工作 - 从传递到方法中的 HTML 生成报告。但是,一旦我将其部署到 Azure Web App Service,我就会收到502 - Bad Gateway错误,如附件所示(为了整洁起见,在 Swagger 中显示)。

在此输入图像描述

控制器:

[HttpPost]
[Route("[action]")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> AgencyDownload([FromBody] AgencyReportSubmissionDto filters)
{
  var user = await _userService.GetUserByIdAsync(HttpContext.User.GetUserId());

  // Generate the PDF
  var content = await _agencyReport.Generate(user, null, filters.FilterDate, filters.Content, filters.Type);

  // Return the PDF to the browser
  return new FileContentResult(content.BinaryData, "application/pdf") { FileDownloadName = "report.pdf" };
}
Run Code Online (Sandbox Code Playgroud)

服务:

public …
Run Code Online (Sandbox Code Playgroud)

c# azure azure-web-app-service asp.net-core ironpdf

9
推荐指数
1
解决办法
1892
查看次数

标签 统计

asp.net-core ×1

azure ×1

azure-web-app-service ×1

c# ×1

ironpdf ×1