ERROR_MESSAGE_MAIN ERROR_MESSAGE_REASON on iPad and Iphone in .Net Application

ERROR_MESSAGE_MAIN ERROR_MESSAGE_REASON on iPad and Iphone in .Net Application

我正在使用 windows.open('url') 从 c# web api 下载 excel。它正在每个浏览器中下载。但是对于 Ipad 和 Iphone,文件已下载,但我在屏幕上出现以下错误

ERROR_MESSAGE_MAIN ERROR_MESSAGE_REASON

我正在使用以下代码 return 存储在内存流中的 excel 数据

HttpResponseMessage result = null;

result = Request.CreateResponse(HttpStatusCode.OK);
result.Content = new StreamContent(mem);
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
    FileName = "myexcel.xlsx"
};
return result;

我在 PHP 中看到了同样的问题。我尝试检查相同的内容,但他给出了错误的内容类型。 Url:-

我在其他地方检查了同样的问题并尝试了下面的代码更改。我添加了桌面变量,以便在移动设备上,我可以按照建议添加另一个流。但是没用。

if (isDesktop)
{
    result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
} 
else
{
    result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
}
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
    FileName = "myexcel.xlsx"
};
return result;

已编辑 - 我正在使用 ClosedXml 创建 excel。 Github link 已关闭 XMl 问题 - https://github.com/ClosedXML/ClosedXML/issues/279

我使用 Eppus 解决了这个问题,因为我找不到 closedXml 的任何解决方案。