PDF创建功能在部署后崩溃

时间:2016-09-16 13:16:16

标签: c# asp.net-mvc pdf iis itext

我有方法,它根据从模型中检索到的信息从视图创建pdf文件。它在调试模式下在我的电脑上没有任何问题,但是在IIS服务器(不同的机器)上部署后它开始崩溃。 我已经使用汇编授予了地图上所有用户的完全访问权限,但它没有帮助。 错误信息没用,只说“出了问题”

  

描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

我的代码:

    [HttpPost]
    public ActionResult EmployeesForExamination(List<EmployeeListForHealthExamination> model)
    {
        List<EmployeeListForHealthExamination> listForPrint = new List<EmployeeListForHealthExamination>();
        foreach (var item in model)
        {
            if (item.printDoc)
            {
                return CreatePDF(item);
            }
        }
        return View(model);   
    }
    [AllowAnonymous]
    public ActionResult ReportForHE(EmployeeListForHealthExamination model)
    {
        using (var db = new HRMEntities())
        {
            model.harmingFactorList = db.EmployeeHarmingFactors.Where(e => e.EmployeeId == model.EmployeeId).ToList();
            return PartialView("Partial/_ReportHE", model);
        }
    }

    [AllowAnonymous]
    public ActionResult CreatePDF(EmployeeListForHealthExamination model)
    {
        return new ActionAsPdf("ReportForHE", model)
        {
            FileName = model.FirstName + model.LastName + "HealthExamination.pdf"
        };
    }

enter image description here

1 个答案:

答案 0 :(得分:0)

这个问题可能是因为在服务器上缺少旧版Visual c ++的visual c ++,尝试升级它。

相关问题