简体   繁体   English

部署后PDF创建功能崩溃

[英]PDF creation function crashes after deployment

I have method, which creates a pdf file from the view, based on information retrieved from the model.我有方法,它根据从模型中检索到的信息从视图中创建一个 pdf 文件。 It works without any problem on my pc in debug mode, however after deployment on IIS server (different machine) it started crashing.它在调试模式下在我的电脑上没有任何问题,但是在 IIS 服务器(不同的机器)上部署后它开始崩溃。 I have granted full access to all user on a map with assembly but it didn't help.我已通过程序集授予对地图上所有用户的完全访问权限,但没有帮助。 Error message is useless it only says that "something went wrong"错误信息是无用的,它只说“出现问题”

Description: An unhandled exception occurred during the execution of the current web request.说明:在执行当前 Web 请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code.请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

My Code:我的代码:

    [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"
        };
    }

在此处输入图片说明

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM