首页 > 解决方案 > 无法使用 https 下载 excel 文件

问题描述

我在 ASP.NET Core 中编写了一个 api,用于下载 excel 文件。我的代码是 -

[Route("api/[controller]")]
[ApiController]
public class ReportController : ControllerBase {
    [HttpGet]
    [Route("GetReport")]
    public async Task<IActionResult> GetReport(string itemKey = "", bool detailed = false, CancellationToken ct = default)
    {
        var stream = await _logic.PerpetualDiscrepencyReport(itemKey, detailed, ct);
        return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Report.xlsx");
    }
}

在本地,我可以使用 http 和 https 访问 url 和下载报告。但是在暂存(IIS 服务器)中,我无法使用 https 访问报告 url。如果我使用 http,我可以通过点击 url 来下载报告。我应该在 iis 配置中做任何事情以能够使用 https 获取报告吗?其他 api 在 https 上运行良好。

标签: c#asp.net-core

解决方案


推荐阅读