Xls Export in not 运行 在服务器上

Xls Export in not running on the server

 public ActionResult ExportToExcel()
    {   
        GridView gv = new GridView();
        gv.DataSource = db.Details.Select(x => new
        {
            x.Title,
            Category = x.Category.Title,
            SubCategory = x.SubCategory.Title,
            x.Count,
            x.Price,
            Automobiles = x.Automobiles.Count,
            x.Description
        }).ToList();
        gv.DataBind();
        Response.ClearContent();
        Response.Buffer = true;            
        Response.AddHeader("content-disposition", "attachment; filename=Marklist.xls");
        Response.ContentType = "application/ms-excel";
        Response.Charset = "";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gv.RenderControl(htw);
        Response.Output.Write(sw.ToString());
        Response.Flush();
        Response.End();
        return Json(true);
    }

导出在本地运行良好。它不适用于 Azure。下载一个空文件。告诉我有什么问题?

您的问题可能与 Excel 的最新 Microsoft 安全更新有关。

见...